PDF to Tiff

simple api needed

Page 1 of 1

6 Replies - 24112 Views - Last Post: 12 May 2009 - 10:11 AM Rate Topic: -----

#1 samuraitux  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 65
  • Joined: 29-April 09

PDF to Tiff

Posted 11 May 2009 - 04: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
Is This A Good Question/Topic? 0
  • +

Replies To: PDF to Tiff

#2 samuraitux  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 65
  • Joined: 29-April 09

Re: PDF to Tiff

Posted 11 May 2009 - 05: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 offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 167
  • Joined: 09-April 09

Re: PDF to Tiff

Posted 12 May 2009 - 03: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 - 03:06 AM

Was This Post Helpful? 1
  • +
  • -

#4 samuraitux  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 65
  • Joined: 29-April 09

Re: PDF to Tiff

Posted 12 May 2009 - 06: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

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 65
  • Joined: 29-April 09

Re: PDF to Tiff

Posted 12 May 2009 - 09: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 image(s)

  • Attached Image

Was This Post Helpful? 1
  • +
  • -

#6 Cha0sBG  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 167
  • Joined: 09-April 09

Re: PDF to Tiff

Posted 12 May 2009 - 10:09 AM

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

#7 samuraitux  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 65
  • Joined: 29-April 09

Re: PDF to Tiff

Posted 12 May 2009 - 10: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
  • +
  • -

Page 1 of 1