简体   繁体   中英

C# printing an existing pdf file and print preview

I have generated a pdf report with itextsharp library, and now I want to print this pdf file. I have google for how to print a pdf file but all the examples are working fine for text files or a line of text not a pdf file, for pdf file they are just printing a bunch of ASCII characters. So is there any example about how to print a pdf file or I should use another library. Any example I would really appreciate that.

Thanks in advance...

If you are familiar with the structure of pdf file then you know that pdf file is not in the same format like doc or txt file. They use Different structure for text rendering. So you can not directly printpreview a pdf file. If you want to printpreview a pdf file then you have to follow the instructions below:

  1. Have to convert pdf file into image per page. // you can do it using ghost script or xpdf
  2. Then you can print or printpreview each image for each page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM