0

我有 ac# dll,它使用 HiQPdf 从文件中打印 PDF。问题是打印的 PDF 在左上角添加了一个字符串,上面写着“HiQPdf 评估”。边距也大大增加,使图像更小。

当我打开pdf并从那里打印时,它很好。我在添加的字符串上找不到任何东西,所以希望这里的人可能有一些见解:)

代码:

    public void PrintFromFile(string fileName, System.Drawing.Printing.PrinterSettings printerSettings)
    {
        var imagePrinter = new PdfPrinter();
        imagePrinter.PrinterSettings.Copies = printerSettings.Copies;
        imagePrinter.PrinterSettings.Duplex = printerSettings.Duplex;
        imagePrinter.PrinterSettings.FromPage = printerSettings.FromPage;
        imagePrinter.PrinterSettings.MaximumPage = printerSettings.MaximumPage;
        imagePrinter.PrinterSettings.MinimumPage = printerSettings.MinimumPage;
        imagePrinter.PrinterSettings.PrinterName = printerSettings.PrinterName;
        imagePrinter.PrinterSettings.PrintFileName = printerSettings.PrintFileName;
        imagePrinter.PrinterSettings.PrintRange = printerSettings.PrintRange;
        imagePrinter.PrinterSettings.PrintToFile = printerSettings.PrintToFile;
        imagePrinter.PrinterSettings.ToPage = printerSettings.ToPage;
        imagePrinter.PrinterSettings.Collate = printerSettings.Collate;

        var pdf = new MemoryStream(System.IO.File.ReadAllBytes("V:\\AccW2\\" + fileName));
        pdf.Position = 0;
        imagePrinter.PrintPdf(pdf);
    }
4

1 回答 1

1

如果您的 PrintPdf 函数中有 HtmlToPdf 元素,则应设置您的 SerialNumber

    private void PrintPdf(string htmlbody, string pdfname)
{
    HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
    // set a demo serial number
    htmlToPdfConverter.SerialNumber = "-- HiQPdf Serial Number --";

}
于 2018-01-30T10:22:02.940 回答