Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

PDF printing and margins Options
serializer
Posted: Thursday, February 1, 2018 1:27:43 PM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 48
Hi,

I tried settings margins but it does not reflect on the print out. It always print with 0 margin. I have tried to set values on both;

Code: Visual Basic.NET
Dim pgs As New System.Drawing.Printing.PageSettings()
        pgs.Margins = New System.Drawing.Printing.Margins(psc.MarginLeft, psc.MarginRight, psc.MarginTop, psc.MarginBottom)


and

Code: Visual Basic.NET
Dim ps As New System.Drawing.Printing.PrinterSettings()
     ps.DefaultPageSettings.Margins.Left = psc.MarginLeft
        ps.DefaultPageSettings.Margins.Right = psc.MarginRight
        ps.DefaultPageSettings.Margins.Top = psc.MarginTop
        ps.DefaultPageSettings.Margins.Bottom = psc.MarginBottom


Here is the full code:

Code: Visual Basic.NET
'Create objects for printer and page settings and PrintDocument
        AddHandler EO.Base.Runtime.Exception, AddressOf EOException

        Dim ps As New System.Drawing.Printing.PrinterSettings()

        Dim pgs As New System.Drawing.Printing.PageSettings()

        pgs.Margins = New System.Drawing.Printing.Margins(psc.MarginLeft, psc.MarginRight, psc.MarginTop, psc.MarginBottom)

        ' print range
        Select Case psc.PrintRange
            Case EnmPrintRange.AllPages
                    ' do nothing
            Case EnmPrintRange.CurrentPage
                pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.CurrentPage
            Case EnmPrintRange.Selection
                pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
            Case EnmPrintRange.SomePages
                pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
        End Select

        ' add support for printing specific pages
        If psc.SelectedPages IsNot Nothing Then
            Dim selectedPages As String = GetSelectedPages(psc.SelectedPages)
            Dim pages() As String = selectedPages.Split(",".ToCharArray)
        End If

        'Set printer name
        ps.PrinterName = psc.SelectedPrinter

        'Set PageMargins (if required)
        ps.DefaultPageSettings.Margins.Left = psc.MarginLeft
        ps.DefaultPageSettings.Margins.Right = psc.MarginRight
        ps.DefaultPageSettings.Margins.Top = psc.MarginTop
        ps.DefaultPageSettings.Margins.Bottom = psc.MarginBottom

        ' copies
        ps.Copies = psc.NoOfCopies

        pgs.PrinterSettings = ps

        Dim pdfdoc As New PdfDocument(psc.File, psc.Password)

        Dim IsLandscape As Boolean = False
        If pdfdoc.Pages.Count > 0 Then
            IsLandscape = pdfdoc.Pages(0).Size.Width > pdfdoc.Pages(0).Size.Height
        End If

        Select Case psc.PageSettings.PaperOrientation
            Case EnmOrientation.Landscape
                pgs.PrinterSettings.DefaultPageSettings.Landscape = True
            Case EnmOrientation.Portrait
                pgs.PrinterSettings.DefaultPageSettings.Landscape = False
            Case EnmOrientation.Auto
                pgs.PrinterSettings.DefaultPageSettings.Landscape = IsLandscape
        End Select


        Dim mt As EO.Base.ManualTask = pdfdoc.Print(ps, pgs)
        mt.WaitOne()
        RemoveHandler EO.Base.Runtime.Exception, AddressOf EOException
eo_support
Posted: Thursday, February 1, 2018 1:59:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,365
Hi,

This appears to be an issue. We are looking into this and will get back to you as soon as we find anything.

Thanks!
serializer
Posted: Tuesday, February 13, 2018 4:21:19 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 48
Have you found any solution. I hope you find it soon as I bough the PDF component especially for printing.
eo_support
Posted: Tuesday, February 13, 2018 10:06:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,365
Hi,

Sorry about the delay. We did find what caused the problem but we are still trying the find the solution.

The root of the problem is the PDF print feature relies on the PDF plugin, and some printing settings, including margins are purposely ignored when printing a plugin. The reason is very simple ---- the plugin has its own settings. For example, a PDF page typically already have margins on the page (for example, if you use our HTML to PDF feature to create PDF file, then by default it would have 1 inch margins on all sides). So if the plugin were to honor the printing margins, it would result in double margins and it usually is not what user wanted.

What we are currently looking into is to have a way to allow "double marging" if you really do want that. This means if the PDF page already have a 1 inch margin on the page and you set another 0.5 inch margin for printing, then the final margin will be 1.5 inch. It is not possible for us to override the 1 inch margin the PDF page with the 0.5 margin you specified for printing because the 1 inch margin in the PDF file is not a simple margin settings --- it's just none of the drawing operation in the page choose not to draw in the margin area. The double margin feature can be useful if you wish to enlarge the existing margin in the PDF page. However it does not have much use beyond that.

Thanks!
serializer
Posted: Wednesday, February 14, 2018 4:35:24 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 48
Yes, the double margin could be an option. Right now, the printing is done outside of printer margins for customer so I doubt some default settings are used (text is cut right now).
eo_support
Posted: Thursday, February 15, 2018 1:26:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,365
Hi,

Many printer has a "non-printable" area so it can't print to too close to the edge of the paper. This does not mean the program did not honor the margin. If the text in the PDF file is too close to the edge, then it can be cut. In that case the "correct" solution would be to modify the PDF file so that you have enough margin on the page.

Nevertheless, we are still looking into the double margin options to see if it is possible for us to support it.

Thanks
serializer
Posted: Monday, March 19, 2018 5:01:34 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 48
Hi, any updates? I purchased the PDF product from you for specifically printing and I still cannot print with margins properly.

Thanks
eo_support
Posted: Monday, March 19, 2018 10:59:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,365
I understand and I am sorry about the delay. We ran into some significant problems with this particular issue since this is something the browser engine wasn't designed to do. As a result it was temporarily put on hold. We will expedite it and see what we can do. In the case that we can not get the double margin previously discussed working, we would be gladly issue a refund to you if you prefer.
serializer
Posted: Tuesday, March 20, 2018 3:43:05 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 48
eo_support wrote:
I understand and I am sorry about the delay. We ran into some significant problems with this particular issue since this is something the browser engine wasn't designed to do. As a result it was temporarily put on hold. We will expedite it and see what we can do. In the case that we can not get the double margin previously discussed working, we would be gladly issue a refund to you if you prefer.


You mean the PDF engine (not the browser engine)? You mean that the PDF engine was not designed to print?

It sounds like you are not even trying to get the double margin working now - that development has stopped?

I am generally not interested in a refund as time has been spent to integrate this PDF engine. I would rather see that you try to solve the problem.
eo_support
Posted: Tuesday, March 20, 2018 9:17:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,365
That's not accurate. The PDF printing feature is done by Chromium's built-in PDF plugin through Chromium's general printing interface. In a way, when you try to print a PDF file through code, it does essentially the same thing as loading a PDF file with Google Chrome browser and then print that PDF file.

When Chromium prints a document, it is either a regular HTML document, or a plugin. If it is a regular HTML document, it applies all the margins you set. If it is a plugin, it just hands it off to the plugin and let the plugin define its own page margins. This is the case for the PDF file. In another word, the Chromium engine does not have the code path that does both: applying margins as a regular document and then continue onto the plugin. This is the part that we were trying to add but it requires too much code changes and we ran into other issues and the effort was stopped.

We will re-evaluate the issue again and see if we can find a cleaner solution ---- however if we still can not find a cleaner solution, we will not be able to do it. We need to maintain a stable product so we can not risk potentially cause other problems while trying to implement requirement for a single user --- we will always try our best, but we have thousands of customers and they would always want things that's not there. It is simply not possible for us to satisfy them all. So we have to maintain a balance on things. In your case, printing PDF is supported, printing PDF with double margin is not currently supported and may not be supported in the future as well.

In any case, we will still do our best to work with you closely ---- including maybe finding a workaround for your situation ---- even if it is not the way you wanted, it may still help to a certain degree and we are always willing to do that.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.