Incorrect printed page size

Hello,

It seems, that Aspose.Words prints 1-st page of my DOCX file incorrectly. This page size should have “Envelope No. 10” size, but Aspose.Words prints it as “A4”.

Just for experiment, I used Aspose.Words to save this DOCX file as PDF and output PDF page size is correct.

My code snippet is below.

The source DOCX file and two screenshot image are an attachment.

Please let me know if you are able to fixe this issue soon.

Mikhael
incorrect printed page size.zip (536.2 KB)


    Dim sFile = "C:\Users\Mikhael\Desktop\Casey Newsom\1032034.docx"
    Dim sPrinter = "Canon iR C3000 Series UFR II"

    Try
        Dim myDoc As New Aspose.Words.Document(sFile)

        myDoc.Save("D:\out\1032034.pdf", Words.SaveFormat.Pdf)

        Dim ps As New System.Drawing.Printing.PrinterSettings() With {.PrinterName = sPrinter}

        myDoc.Print(ps, GetFileNameExt(sFile))
    Catch ex As Exception
    End Try

@Mikhael You should use PageSetup.FirstPageTray and PageSetup.OtherPagesTray properties to specify which paper source should be used for the first and other pages in sections.
In your document paper tray is not specified and the default one is used.

Hello @alexey.noskov,

If I use my code snippet to print DOCX fil I attached, 1-st page is printed on A4, and 2-nd - on Letter page. So, it seems, that Aspose.Words selected printed page size automatically without PageSetup.FirstPageTray and PageSetup.OtherPagesTray properties usage.

The same output paper size autodetection happened if I use Microsoft Word 2019 to print this file.

The only one difference: MS Word detects 1-st page size correctly, but Aspose.Words – incerrectly.

I use “Auto” value for Paper source feature in my Canon iR C3000 Series UFR II printer driver settings panel.

image.png (58.2 KB)

Please let me know if I should share my printer driver distributive file to let you install it to try print files on this driver and see print preview. This ability can be used even if you not have this printer, connected to your computer.

Mikhael

@Mikhael

Yes, please share your printer driver here for testing. I will check once again with it and provide you more information.

Hello @alexey.noskov,

  1. Please follow this link to download my printer driver disctributive file:
    https://download.print-driver.com//ex/mb/Canon_imageRUNNER_C3025_GPlus_PCL6_Driver_V210_32_64_00.zip

  2. Go to “Control panel->Devices and printers” and click “Add printer”

  3. Click “Add a local printer or network printer with manual settings”, as you can see on the screenshot image below:

  4. Select “FILE” as an existing port to be able to use a driver of the printer you do not connected to your computer:

  5. Click “Have a disk” and then select “Cnp60MA64.INF” file you can find in folder “GPlus_PCL6_Driver_V210_32_64_00\x64\Driver”

  6. Open printer preferences as soon as you finished printer driver installation.

  7. Change “Edit and Preview” as output method value:

Please let me know if you are able to use my instruction to install and configure this printer driver and to be able to reproduce issue with page size detection I reported.

Alternatively I can assist you remotely to do this using Team Viewer software. Just let me know.

Mikhael

@Mikhael Thank you for additional information and the detailed guidelines. But, unfortunately, the problem is not reproducible on my side. Please see the screenshot of the document print preview: image.png (130.1 KB)
Also here is a .PRN file produced: out.zip (101.2 KB)

I have used the latest 22.2 version of Aspose.Words for testing. Which version do you use on your side?

@alexey.noskov, I also use version 22.2 and my print preview looks as you can see on this screenshot image: image.png (338.6 KB)

Do you have any idea how can I make any log for you or what variables I can check to let you see what happened on my copmuter to let you advice me how should I change my code snippet?

I can start Team Viewer if you want to see what happened on my side. Just let me know.

Mikhael

@Mikhael Could you please run the following code on your side and share you output here;

    Dim settings As New PrinterSettings()
    settings.PrinterName = "Canon Generic Plus PCL6"

    For i As Integer = 0 To settings.PaperSizes.Count - 1
        Console.WriteLine(settings.PaperSizes(i))
    Next

    Console.WriteLine("====================================")

    For i As Integer = 0 To settings.PaperSources.Count - 1
        Console.WriteLine(settings.PaperSources(i))
    Next

    Console.WriteLine("====================================")

    Dim doc As New Document("C:\Temp\in.docx")
    For i As Integer = 0 To doc.PageCount - 1
        Dim pageInfo As PageInfo = doc.GetPageInfo(i)
        Console.WriteLine(pageInfo.GetDotNetPaperSize(settings.PaperSizes))
        Console.WriteLine(pageInfo.GetSpecifiedPrinterPaperSource(settings.PaperSources, settings.DefaultPageSettings.PaperSource))
        Console.WriteLine("---------------------------------")
    Next

On my side the output looks like this:

[PaperSize Letter Kind=Letter Height=1100 Width=850]
[PaperSize 11x17 Kind=Standard11x17 Height=1700 Width=1100]
[PaperSize Legal Kind=Legal Height=1400 Width=850]
[PaperSize Executive Kind=Executive Height=1050 Width=725]
[PaperSize A5 Kind=A5 Height=827 Width=583]
[PaperSize B5 Kind=B5 Height=1012 Width=717]
[PaperSize A4 Kind=A4 Height=1169 Width=827]
[PaperSize B4 Kind=B4 Height=1433 Width=1012]
[PaperSize A3 Kind=A3 Height=1654 Width=1169]
[PaperSize Custom [Name Fixed] Kind=Custom Height=1100 Width=850]
====================================
[PaperSource Auto Kind=AutomaticFeed]
[PaperSource Multi-purpose Tray Kind=Manual]
[PaperSource Drawer 1 Kind=Upper]
====================================
[PaperSize Custom Kind=Custom Height=412 Width=950]
[PaperSource Auto Kind=AutomaticFeed]
---------------------------------
[PaperSize Letter Kind=Letter Height=1100 Width=850]
[PaperSource Auto Kind=AutomaticFeed]
---------------------------------

Also as a workaround, you can try converting your document to XPS and use XPS print API to print your document.

Hello @alexey.noskov,

My code snippet and the output window content are below.

It seems, that printer driver I sent you and driver installed on my computer are different, because list of paper sizes your and my printer can use are different. So, shall I try find the same dreiver? Or we can use Team viewer to debug this issue on my computer?

Yes, I can use workaround for this issue: Aspose.Words is able to convert this DOCX to PDF correctly. After this I can use my code to print PDF. Unfortunately, performance of this tricky print is lower than direct printing DOCX file using Aspose.Words.

Plus, a customer, who uses printing solution I develop is also able to reproduce this issue…

Dim settings As New System.Drawing.Printing.PrinterSettings()
settings.PrinterName = "Canon iR C3000 Series UFR II"

Console.WriteLine("settings.PrinterName = " + settings.PrinterName)

For i As Integer = 0 To settings.PaperSizes.Count - 1
    Console.WriteLine(settings.PaperSizes(i))
Next

Console.WriteLine("====================================")

For i As Integer = 0 To settings.PaperSources.Count - 1
    Console.WriteLine(settings.PaperSources(i))
Next

Console.WriteLine("====================================")

Dim doc As New Words.Document("C:\Users\Mikhael\Desktop\Casey Newsom\1032034.docx")
Console.WriteLine("doc.OriginalFileName = " + doc.OriginalFileName)

For i As Integer = 0 To doc.PageCount - 1
    Dim pageInfo As Words.Rendering.PageInfo = doc.GetPageInfo(i)

    Console.WriteLine(pageInfo.GetDotNetPaperSize(settings.PaperSizes))
    Console.WriteLine(pageInfo.GetSpecifiedPrinterPaperSource(settings.PaperSources, settings.DefaultPageSettings.PaperSource))
    Console.WriteLine("---------------------------------")
Next

doc.Print(settings)

And here is the output screen content:

settings.PrinterName = Canon iR C3000 Series UFR II
[PaperSize Letter Kind=Letter Height=1100 Width=850]
[PaperSize 11x17 Kind=Standard11x17 Height=1700 Width=1100]
[PaperSize Legal Kind=Legal Height=1400 Width=850]
[PaperSize Statement Kind=Statement Height=850 Width=550]
[PaperSize Executive Kind=Executive Height=1050 Width=725]
[PaperSize A5 Kind=A5 Height=827 Width=585]
[PaperSize B5 Kind=B5 Height=1012 Width=717]
[PaperSize A4 Kind=A4 Height=1169 Width=827]
[PaperSize B4 Kind=B4 Height=1433 Width=1012]
[PaperSize A3 Kind=A3 Height=1654 Width=1169]
[PaperSize Envelope Monarch Kind=MonarchEnvelope Height=750 Width=387]
[PaperSize Envelope No. 10 (COM10) Kind=Number10Envelope Height=950 Width=412]
[PaperSize Envelope DL Kind=DLEnvelope Height=866 Width=433]
[PaperSize Envelope C5 Kind=C5Envelope Height=902 Width=638]
[PaperSize SRA3 Kind=Custom Height=1772 Width=1260]
[PaperSize 12x18 Kind=Custom Height=1800 Width=1200]
[PaperSize Custom [Name Fixed] Kind=Custom Height=1169 Width=827]
====================================
[PaperSource Auto Kind=AutomaticFeed]
[PaperSource Multi-purpose Tray Kind=Manual]
[PaperSource Drawer 1 Kind=Upper]
[PaperSource Drawer 2 Kind=Middle]
[PaperSource Paper Type Priority Kind=Custom]
====================================
doc.OriginalFileName = C:\Users\Mikhael\Desktop\Casey Newsom\1032034.docx
[PaperSize Custom Kind=Custom Height=412 Width=950]
[PaperSource Auto Kind=AutomaticFeed]
---------------------------------
[PaperSize Letter Kind=Letter Height=1100 Width=850]
[PaperSource Auto Kind=AutomaticFeed]
---------------------------------

Hello @alexey.noskov,

I found driver version to reproduce issue I reported. I installed it on my VmWare Workstation and reproduced this issue with wrong 1-st page size!

Please let me know if you are able to reproduce this issue on your computer.

https://download.print-driver.com/ex/mb/UFRII-Printer-Driver-V30.12.zip

Mikhael

@Mikhael Thank you for additional information. I have managed to reproduce the problem with this driver. For a sake of correction the issue has been logged as WORDSNET-23505. We will keep you informed and let you know once it is resolved.

@alexey.noskov,

Great news!

Thank you for your service!

Mikhael

The issues you have found earlier (filed as WORDSNET-23505) have been fixed in this Aspose.Words for .NET 22.5 update also available on NuGet.

Thank you very much!

MB

1 Like