Graphics class for DynaPDF

  1. 7 months ago

    Christian S

    2 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    We are integrating DynaPDF with the Graphics class in Xojo. You can get a graphics object to draw into the current page via normal graphics class methods. The code looks like this:

    Dim g as graphics = pdf.PageGraphics

    Technically we create a temporary picture with a subclassed graphics class and give you the graphics object from the picture. You can get the temporary picture with PageGraphicsPicture property. All draws go both into the picture and the PDF page:


    Dim p as picture = pdf.PageGraphicsPicture


    We support normal drawing commands in graphics class and the usual properties. Draw/Fill Oval/Rect/RoundRect/Line/Polygon will just work. DrawString draws text for single and multi line. StringHeight and StringWidth measure text via DynaPDF functions, so the result may be different than in a picture, but you get the right values needed for the PDF output. DrawPicture can draw picture with alpha channel and masks if needed. NextPage method will close current page and make a new one. Or you implement NextPage event to do this yourself. Then you can import existing page as background.

    We support vector graphics classes (Object2D) and drawObject command. Most properties should work and this includes transparency and rotation.

    As the report engine is built on Object2D, the report engine can output to PDF via our graphics class.

    This works in all Xojo versions (And Real Studio), with all DynaPDF editions and come soon with next 19.2 prerelease.

  2. Christian S

    2 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    -image-

  3. Martin T

    2 May 2019 Pre-Release Testers Germany
    Edited 7 months ago

    Great work Christian. Would you please share your XDC info to DynaPDF to with us who can't be there? Would be nice.

    @ChristianSchmitz Most properties should work and this includes transparency and rotation.

    Does this also apply to setting colors in Xojo format with alpha value?

  4. Christian S

    2 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    DynaPDF 5.0

    • Coming later this year
    • Full unicode support
    • Automatic Font Substitution
    • ZUGFeRD 2.0 (standard for invoices as PDF)
    • Verify digital signatures

    that was the slide for DynaPDF 5.

  5. Martin T

    2 May 2019 Pre-Release Testers Germany

    Super nice. Does your bridge auto translates Xojo' 72 DPI coordinates to DynaPDF?

  6. Christian S

    2 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    PDF also uses 72dpi grid for drawing unless you change it.

  7. Christian S

    3 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    and uploaded new plugins:
    https://www.mbsplugins.de/archive/2019-05-03/MBS_Xojo_Plugins_version_192pr

  8. Christian S

    6 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Here a nice short example on how to draw a PDF with our new PageGraphics property in DynaPDFMBS class:

    Dim pdf As New DynapdfMBS
    // please subclass DynapdfMBS to implement error event
    
    Dim f As FolderItem = SpecialFolder.Desktop.Child("DynaPDF Graphics.pdf")
    
    'pdf.SetLicenseKey "Starter" 
    // For this example you can use a Starter, Lite, Pro or Enterprise License
    
    // Create new PDF. Use f = nil for in-memory PDF
    Call pdf.CreateNewPDF(f)
    
    // append a new page, so we have an open page
    Call pdf.Append 
    
    // get graphics object to draw on the page
    Dim g As Graphics = pdf.PageGraphics
    
    // draw as usual
    g.DrawString "Hello World", 105, 100
    g.DrawRect 100, 80, 100, 100
    
    // close page and file
    Call pdf.EndPage 
    Call pdf.CloseFile
    
    // for in-memory PDF, use GetBuffer here to grab it.
    'Dim PDFData As String = pdf.GetBuffer

    You can put the actual drawing code into a method with g as graphics parameter and than call it on several places. e.g. call it from Canvas.Paint event to show it in a window, call it with graphics from OpenPrinterDialog to draw in printing context or call it with PageGraphics to draw into a PDF document.

  9. scott b

    6 May 2019 Pre-Release Testers, Xojo Pro local coffee shop

    again this is something else amazing that @ChristianSchmitz and company has done to make our lives easier. thank you!

  10. Christian S

    16 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Anyone tried it and can report some issues to be fixed before 19.2 release?

  11. Christian S

    23 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    We made a blog article for the Xojo blog:

    Using the Graphics Class to Create PDF Documents

    MBS Xojo Plugins are part of the sale this weekend on the Xojo store.

  12. 6 months ago

    Christian S

    26 May 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    A few fixes are coming for next version to improve this.

or Sign Up to reply!