Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Sep 15, 2021 4:18 pm

Hello,
I purchased Spire.Office 6.8.2 which contains Spire.PDF 7.8.9, and I encounter an issue when printing a PDF with an art box.
The size of our PDF is 8.25 x 3.25 inches and the size of our label is 8.125 x 2.25, when printing with Spire.PDF, it ignores all boxes (Trim box, crop box, bleed box, art box). Any suggestions how I can print just the art box?
Also, I am having an issue with the way spire prints colors, they don't come up they way I would like.
Attached you will find pictures of the issues I am having.

Printer: Epson TM-C7500G
Enviroment, Win10pro 64, English United States
Framework .NET 4.7.2

Here is the code I am using to print
Code: Select all
       
public static void PrintPDf(byte[] file, bool isColor)
        {
            PdfDocument pdfdocument = new PdfDocument();
            pdfdocument.LoadFromBytes(file);
            PrinterAccess.SetPrinterSettings(pdfdocument, isColor);
            pdfdocument.Print();
            pdfdocument.Dispose();
        }

settings
Code: Select all
 public static void SetPrinterSettings(PdfDocument pdfDocument, bool isColor)
        {
            var printerSettings = GetPrinterSettings();
            pdfDocument.PrintSettings.Copies = printerSettings.PrinterSettings.Copies;
            pdfDocument.PrintSettings.PaperSize = printerSettings.PageSettings.PaperSize;
            pdfDocument.PageSettings.Size = printerSettings.PageSettings.PrintableArea.Size;
            pdfDocument.PageSettings.Margins.All = 0;
            if (isColor)
            {
                pdfDocument.PrintSettings.Color = true;
                pdfDocument.ColorSpace = PdfColorSpace.CMYK;
                pdfDocument.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize, true);
            }
            else
            {
                pdfDocument.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, false);
            }
            pdfDocument.PrintSettings.PrintController = new StandardPrintController();
        }

kraft_it
 
Posts: 3
Joined: Mon Jun 28, 2021 7:53 pm

Thu Sep 16, 2021 9:22 am

Hello,

Thanks for your inquiry.
Sorry that we don’t have the same printer Epson TM-C7500G as yours, but when I tested with our printers, I did not find that all boxes were ignored like you mentioned. I noticed that in your code, when “isColor” is true, you set PdfSinglePageScalingMode to ActualSize. Please try changing it to FitSize and see if this problem occurs.. Also, please try to set the Paper Margins to 0, like the code below.
Code: Select all
            pdfDocument.PrintSettings.SetPaperMargins(0,0,0,0);

Besides, regarding the print color issue, I did notice that the colors printed by our Spire.PDF are inconsistent with the original file. I have logged it in our bug tracking system with the ticket SPIREPDF-4652. If there is any update, we will let you know. Sorry for the inconvenience caused.


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Sep 16, 2021 12:57 pm

Thank you for answering,

I tried using you suggestions and I did not get the desired result.
Here is the code I used:

Code: Select all
       
public static void SetPrinterSettings(PdfDocument pdfDocument, bool isColor)
        {
            var printerSettings = GetPrinterSettings();
            pdfDocument.PrintSettings.Copies = printerSettings.PrinterSettings.Copies;
            pdfDocument.PrintSettings.PaperSize = printerSettings.PageSettings.PaperSize;
            pdfDocument.PageSettings.Size = printerSettings.PageSettings.PrintableArea.Size;
            pdfDocument.PrintSettings.SetPaperMargins(0,0,0,0);
            pdfDocument.PageSettings.Margins.All = 0;
            if (isColor)
            {
                pdfDocument.PrintSettings.Color = true;
                pdfDocument.ColorSpace = PdfColorSpace.CMYK;
                pdfDocument.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, true);
                pdfDocument.PrintSettings.PrintController = new StandardPrintController();
           
            }
                       
        }


Attached is the result.

As for the page boxes, I will ask again, Any suggestions how I can print just the art box?

Thank you.

kraft_it
 
Posts: 3
Joined: Mon Jun 28, 2021 7:53 pm

Fri Sep 17, 2021 10:02 am

Hello,

Thanks for your feedback.
Our Spire.PDF only supports printing the entire page of a PDF file. Sorry, we do not support printing just the art box in your PDF file.
If you have any other questions related to our products, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri Sep 17, 2021 5:58 pm

That's too bad. I hope the dev team finds a fix for the color bug.

Thanks.

kraft_it
 
Posts: 3
Joined: Mon Jun 28, 2021 7:53 pm

Sat Sep 18, 2021 1:22 am

Okay, we will keep you informed if there is any update about the fix of the color bug.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF