School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 340,079 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 4,787 people online right now. Registration is fast and FREE... Join Now!



PDF to Tiff

PDF to Tiff simple api needed Rate Topic: -----

#1 samuraitux  Icon User is offline

  • New D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 22
  • Joined: 29-April 09


Dream Kudos: 25

Posted 11 May 2009 - 03:30 PM

Hey Guys, do you have any suggestions on a pdf api that I can use so that I can take pdf's and rasterize them into a multi page TIFF. I am looking at iTextSharp, PDFsharp, and PDFjet but I am not sure if they will let me do the conversion. Any help would be greatly appreciated. Also I know what the dreamincode policy about good faith codeis but I am not asking for code. I am looking for an API or sdk that is hopefully free or priced reasonably
Was This Post Helpful? 0
  • +
  • -


#2 samuraitux  Icon User is offline

  • New D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 22
  • Joined: 29-April 09


Dream Kudos: 25

Posted 11 May 2009 - 04:35 PM

Well I think I did find something worth looking into. Looks like an open source app called imagemagick is looking pretty good. I will try and test and see. They even have a java port, as well as a perl port so I have plenty of options. But I am still open to suggestions.
Was This Post Helpful? 0
  • +
  • -

#3 Cha0sBG  Icon User is online

  • D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 149
  • Joined: 09-April 09


Dream Kudos: 50

Posted 12 May 2009 - 02:04 AM

Quote

The following code works for converting PDF to TIFF.But for that you have to use the ABCpdf 6.0 .NET Professional


Doc theDoc = new Doc();

theDoc.Read(Server.MapPath("../Pdfreports/Procedure_Report_" + ReportId.ToString() + ".pdf"));

// set up the rendering parameters

theDoc.Rendering.ColorSpace = "Gray";

theDoc.Rendering.BitsPerChannel = 1;

theDoc.Rendering.DotsPerInchX = 200;

theDoc.Rendering.DotsPerInchY = 400;

// loop through the pages

int n = theDoc.PageCount;

for (int i = 1; i <= n; i++)

{

theDoc.PageNumber = i;

theDoc.Rect.String = theDoc.CropBox.String;

theDoc.Rendering.SaveAppend = (i != 1);

//theDoc.Rendering.SaveCompression = XRendering.Compression.G4;

theDoc.SetInfo(0, "ImageCompression", "4");

theDoc.Rendering.Save(Server.MapPath("../Pdfreports/Procedure_Report_" + ReportId.ToString() + "_" + i.ToString() + ".tiff"));

}

theDoc.Clear();


This was taken from: http://social.msdn.m...8-775f6d091ab1/

And here is a download link for the abcpdf .NET: http://wareseeker.co...ee-abcpdf-.net/

Hope it helps you.

~Cha0sBG

This post has been edited by Cha0sBG: 12 May 2009 - 02:06 AM

Was This Post Helpful? 0
  • +
  • -

#4 samuraitux  Icon User is offline

  • New D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 22
  • Joined: 29-April 09


Dream Kudos: 25

Posted 12 May 2009 - 05:10 AM

Thanks Cha0sBG that has provided me a great start. Thanks for the links.
Was This Post Helpful? 0
  • +
  • -

#5 samuraitux  Icon User is offline

  • New D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 22
  • Joined: 29-April 09


Dream Kudos: 25

Posted 12 May 2009 - 08:35 AM

If someone else is wondering here is the code that I have. I have attached a picture of the app also.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using WebSupergoo.ABCpdf7;
using WebSupergoo.ABCpdf7.Objects;
using WebSupergoo.ABCpdf7.Atoms;
using WebSupergoo.ABCpdf7.Operations; 

namespace CSBconvert
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		public void exitApplication(Object sender, EventArgs e)
		{
			Application.Exit();
		}

		private void btnPDFLoc_Click(object sender, EventArgs e)
		{
			if (openFD.ShowDialog() == DialogResult.OK)
			{
				txtPDFLoc.Text = openFD.SelectedPath.ToString();
			}
		}

		private void btnOutput_Click(object sender, EventArgs e)
		{
			if (openFD.ShowDialog() == DialogResult.OK)
			{
				txtOutput.Text = openFD.SelectedPath.ToString();
			}
		}

		private void btnProcess_Click(object sender, EventArgs e)
		{
			string filePath = txtPDFLoc.Text + "\\";
			string savePath = txtOutput.Text;
			string fileName;
			DirectoryInfo directoryList = new DirectoryInfo(@filePath);
			FileInfo[] pdfFile = directoryList.GetFiles("*.pdf");
			foreach (FileInfo file in pdfFile)
			{
				Doc theDoc = new Doc();
				
				theDoc.Read(filePath + file.Name);

				// set up the rendering parameters

				theDoc.Rendering.ColorSpace = "Gray";
				theDoc.Rendering.BitsPerChannel = 1;
				theDoc.Rendering.DotsPerInchX = 200;
				theDoc.Rendering.DotsPerInchY = 400;
				// loop through the pages
				int n = theDoc.PageCount;
				fileName = Path.GetFileNameWithoutExtension(file.FullName);
				for (int i = 1; i <= n; i++)
				{
					theDoc.PageNumber = i;
					theDoc.Rect.String = theDoc.CropBox.String;
					theDoc.Rendering.SaveAppend = (i != 1);
					//theDoc.Rendering.SaveCompression = XRendering.Compression.G4;
					theDoc.SetInfo(0, "ImageCompression", "4");

					theDoc.Rendering.Save(savePath + "\\" + fileName + ".tiff");			  
				}

				theDoc.Clear();
				 
			}
		}
	}
}



Hope this helps someone else. Now I just need to figure out how I can add a progress bar.

Attached thumbnail(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#6 Cha0sBG  Icon User is online

  • D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 149
  • Joined: 09-April 09


Dream Kudos: 50

Posted 12 May 2009 - 09:09 AM

Hehe no problem samuraitux :) glad to help you.
Was This Post Helpful? 0
  • +
  • -

#7 samuraitux  Icon User is offline

  • New D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 22
  • Joined: 29-April 09


Dream Kudos: 25

Posted 12 May 2009 - 09:11 AM

Another quick update. I have gotten the progress bar to work. I just added it to the end after each conversion.
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month