You are viewing limited content. For full access, please sign in.

Question

Question

ExportPDF Reduce File/Page Size

asked on September 22, 2014

Hello,

I am useing SDK 8.3 to export photographs to PDF. Most images are a reasonable size, however some result in gigantic pdf's; 25" by 19" and over 5MB.

How can I force the output to a KB, Resolution, or page size?

I don't want to max the CompressionQuality because not all the images are huge.

I've tried to use "exporter.PdfPageSize = PdfPageSize.Halfletter;" but it seemed to do nothing.

Here is my current Code..

DocumentInfo docInfo = Document.GetDocumentInfo(Int32.Parse(fileID, System.Globalization.NumberStyles.AllowThousands), session);;
DocumentExporter exporter = new DocumentExporter();
exporter.IncludeAnnotations = true;
exporter.BlackoutRedactions = true;
exporter.PageFormat = DocumentPageFormat.Jpeg;
exporter.CompressionQuality = 90;
exporter.ExportPdf(docInfo, docInfo.AllPages, PdfExportOptions.IncludeText, strLocalPath + strDocumentFILE);

Thanks for any insight.

1 0

Answer

SELECTED ANSWER
replied on September 24, 2014

For lack of a better solution; I'm just hacking it a bit by adjusting the Compression based on the file size.

Here's my working test code..

docSize = Convert.ToInt32(Results.GetDatum(i, SystemColumn.TotalDocSize)); //TEST
if (docSize < 500) //TEST
{
	dq = 90;
}
else if (docSize > 3000)
{
	dq = 40;
}
else if (docSize > 2000)
{
	dq = 50;
}
else if (docSize > 1000)
{
	dq = 60;
}
else
{
	dq = 70;
}
exporter.CompressionQuality = dq; //TEST

Still open to a better (built-in) way.

Thanks.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.