is it possible to set the dpi for pdf file or set the dpi for the image in the pdf file? If it’s yes, then is there any way to locate the image in each page of the pdf file, so that I can fetch that page’s image to process dpi and do compress without quality loss, and finllay I can get the small size of the pdf file
Hi,
Is there any way I can use to calculate each of pdf required size for the final output merged pdf.
Thanks imran.rafique,
For 3 small files, what’s the size for each of them can meet the final output PDF’s size less than 3M? Is there any approach can accomplish it?
Thanks, for example, if I have 3 files, 1M,1.5M 1M, if I can generate final output pdf file with less 3M? any approach I can do to accomplish it? such as the following optimization method.
pdfDocument.OptimizeResources(new Document.OptimizationOptions()
10 {
11 LinkDuplcateStreams = true,
12 RemoveUnusedObjects = true,
13 RemoveUnusedStreams = true,
14 CompressImages = true,
15 ImageQuality = 10
16 });
if couldn’t optimize it to be less than 3M, that means I have to make sure the total size for all 3 little file has to be less than 3M.
Hi,
Document doc = new Document();<o:p></o:p>
// do your stuff
MemoryStream ms = new MemoryStream();
doc.Save(ms);
long filesize = ms.Length;
// Put a check on size in MBs
if ((filesize / (1024 * 1024)) < 3) // Check if less than 3MB
{
// do your stuff
}
In case you have different requirements than my assumption, please share some more details so that we can test the scenario in our environment and respond you accordingly.
Best Regards,
thanks for the code snippet. sorry for not describe it clearly. let me explain it in brief.
Hi,