1.pdf 是正常的 PDF,但当我用 Aspose.PDF 打印出来后,就变成乱码了,2.pdf 是通过 Aspose.PDF 打印的内容
1.pdf (60.6 KB)
2.pdf (212.6 KB)
代码如下:
PdfViewer viewer = new PdfViewer();
viewer.BindPdf(@"C:\Users\Lenovo\Downloads\1.pdf");
viewer.AutoResize = true; // Print the file with adjusted size
viewer.AutoRotate = true; // Print the file with adjusted rotation
viewer.PrintPageDialog = false; // Do not produce the page number dialog when printing
PrinterSettings ps = new PrinterSettings();
PageSettings pgs = new PageSettings();
PaperSize paperSize = new PaperSize()
{
RawKind = (int)PaperKind.A4,
Width = 827,
Height = 1169,
};
pgs.PaperSize = paperSize;
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
pgs.Landscape = false;
Duplex duplexMode = Duplex.Simplex;
ps.Duplex = duplexMode;
viewer.PrintDocumentWithSettings(pgs, ps);
viewer.Close();