PDF to Tiff
Page 1 of 1
PDF to Tiff simple api needed
#1
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
#2
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.
#3
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
#5
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.
Hope this helps someone else. Now I just need to figure out how I can add a progress bar.
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.
Page 1 of 1

Start a new topic
Add Reply




MultiQuote
| 


