cs-pdf-to-image icon indicating copy to clipboard operation
cs-pdf-to-image copied to clipboard

How to improve the resolution of the image?

Open davinchi7 opened this issue 8 years ago • 8 comments

Hi! I have tested the library and it works very well. I would like to know if you can improve the resolution of the image. Thank you very much.

davinchi7 avatar Apr 22 '18 13:04 davinchi7

Did you find any solution for this?

indradeepc avatar Apr 25 '18 12:04 indradeepc

Sorry pretty busy recently with my works, did not have a chance to look at how to resolve this. One way that you may try is to change the Pdf2Image.PrintQuality = 100. If not working, I will look into this issue during weekend.

chen0040 avatar Apr 26 '18 01:04 chen0040

Hello Friend, Thank you very much for your answer. Is it possible that the lack of quality is due to the type of font used in the PDF? Can I send you my PDF for you to try it on? Thank you very much

demo.pdf

davinchi7 avatar Apr 27 '18 16:04 davinchi7

@davinchi7 thanks for the demo.pdf, i think you are right about the font. i was tuning the fonts for the pdf convert, still working on it. below are some of the config i was experimenting:

`/*

        cs_pdf_to_image.Pdf2Image.Config.DisablePrecompiledFonts = true;
        cs_pdf_to_image.Pdf2Image.Config.DisablePlatformFonts = true;
        cs_pdf_to_image.Pdf2Image.Config.DisableFontMap = true;*/

        cs_pdf_to_image.Pdf2Image.Config.FontPath.Add(cs_pdf_to_image.Pdf2Image.GetProgramFilePath("arial.ttf"));
        cs_pdf_to_image.Pdf2Image.Config.SubstitutionFont = "arial";

`

The result is still not good. I will do more test and tuning to see if can get this fixed. if you have some suggestion, pls also share :)

chen0040 avatar Apr 29 '18 15:04 chen0040

In Pdf2Image need set ResolutionX and ResolutionY for PDFConvert. This will increase resolution of the image. I think need to provide additional properties for this in Pdf2Image.

nicksuslov avatar Oct 05 '18 10:10 nicksuslov

Yes I know my reply is just toooooo late but it works for me like this so I said to my self why mot posting.

In the Pdf2Image file you should find those lines.

converter.FitPage = true; converter.JPEGQuality = mPrintQuality; //80 converter.OutputFormat = "tifflzw"; // here you add for a rez of 1700x2200 converter.ResolutionX = 200; converter.ResolutionY = 200;

That it. hope it helps someone.

ghost avatar Nov 22 '19 20:11 ghost

Yes I know my reply is just toooooo late but it works for me like this so I said to my self why mot posting.

In the Pdf2Image file you should find those lines.

converter.FitPage = true; converter.JPEGQuality = mPrintQuality; //80 converter.OutputFormat = "tifflzw"; // here you add for a rez of 1700x2200 converter.ResolutionX = 200; converter.ResolutionY = 200;

That it. hope it helps someone.

Where do you see these options?

GHNJ avatar May 20 '20 23:05 GHNJ

According to my experiment, the following codes helps: // dpi converter.ResolutionX = 200; converter.ResolutionY = 200; // bit depths - 32bits converter.OutputFormat = "pngalpha"; // poor effect to modify this converter.TextAlphaBit = 4; converter.GraphicsAlphaBit = 4; // correct location of image converter.FitPage = false;

Up-Yedou avatar Jan 06 '22 14:01 Up-Yedou