yangin
1
PrintBold.zip (216.5 KB)
問題 Aspose 與 Xchange 列印粗體字比較起來太粗,導致實際列印的效果不佳。
附件中 test.pdf 是原始檔案(使用openoffice writer 製作)
aspose.oxps asposeImage.oxps 使用 Aspose PDF 列印
xchange.oxps 使用 xchange 列印
印表機為 Microsoft XPS Document Writer
asposePrint.pdf 使用 Aspose PDF 經由列印
xchange.pdf 使用 xchange 列印
印表機為 Microsoft Print to PDF
使用 Inkscape 觀察 Aspose 列印出的 PDF 檔案 ,粗體字的邊框比 Xchange 粗,且 Apose 粗體字文字邊框粗細於 12、14 級字沒有改變,導致文字越小越模糊。
有開啟 viewer.PrintAsImage = true; 實際列印效果不佳,不考慮。
@yangin
感谢您与支持人员联系。
您能不能分享SSCCE代码,以便我们可以尝试在我们的环境中重现和调查它。
yangin
3
//printname = “Microsoft Print to PDF” OR “Microsoft XPS Document Writer”
//pdfFile = “Test.pdf”
public void PrintPDF(string pdfFile, string printname)
{
try
{
if(pdfFile == "" || printname == null)
{
System.Windows.Forms.MessageBox.Show("請選擇印表機或選擇PDF檔案");
return;
}
// Create PdfViewer object
PdfViewer viewer = new PdfViewer();
//viewer.PrintAsImage = true;
// Open input PDF file
viewer.BindPdf(pdfFile);
// Set attributes for printing
viewer.AutoResize = false; // Print the file with adjusted size
viewer.AutoRotate = true; // Print the file with adjusted rotation
viewer.PrintPageDialog = true; // Do not produce the page number dialog when printing
//viewer.Resolution = 600;
// Create objects for printer and page settings and PrintDocument
System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
//System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();
//ps.PrinterName = prtdoc.PrinterSettings.PrinterName;
ps.PrinterName = printname;
// Set PageSize (if required)
pgs.PrinterResolution.X =300;
pgs.PrinterResolution.Y = 300;
viewer.AutoRotate = true;
// pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
// pgs.PaperSize = new System.Drawing.Printing.PaperSize("A3", 1169, 827*2);
//ps.Copies = 2;
// Set PageMargins (if required)
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
//pgs.PrinterSettings.Duplex = System.Drawing.Printing.Duplex.Simplex; //單面列印
//pgs.PrinterSettings.FromPage = 0; //起始頁
//pgs.PrinterSettings.ToPage = 2; //結束頁
// Print document using printer and page settings
viewer.PrintDocumentWithSettings(pgs, ps);
// Close the PDF file after priting
viewer.Close();
#if !debug
File.Delete(pdfFile);
#endif
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(“Apdf_02-1” + ex.Message);
}
}
yangin
5