« MBS Xojo Plugins, ver… | Home | MBS Xojo Conference U… »

Use DynaPDF to create a PDF in PDF/X standard for printing

If your printing company asks you to provide PDF documents in PDF/X format, you can create such a PDF in DynaPDF using our DynaPDFMBS class in the MBS Xojo DynaPDF Plugin.

For PDF/X-1 you need to have:

  • All fonts embedded.
  • All colors are CMYK or spot colors.
    If needed convert RGB to CMYK using Optimize function.
  • Add information for the printing condition using AddRenderingIntent function.
  • Set the version in header to the required PDF/X version.
  • Set a trim box for each page, which can be equal to the media box.
  • Set metadata with a document title.
  • Removed all actions.

DynaPDF can do the following PDF/X versions:

  • PDF/X-1a:2001
  • PDF/X-1a:2003
  • PDF/X-3:2002
  • PDF/X-3:2003
  • PDF/X-4p
  • PDF/X-5g
  • PDF/X-5n
  • PDF/X-5pg
  • PDF/X-6
  • PDF/X-6n
  • PDF/X-6p

Please note that newer PDF/X variants may have different conditions.

Let us show you this sample code:

Dim pdf As New MyDynapdfMBS pdf.SetLicenseKey "Lite" // For this example you can use a Lite, Pro or Enterprise License Dim f as FolderItem = SpecialFolder.Desktop.Child("Create PDFX.pdf") Call pdf.CreateNewPDF f Call pdf.SetDocInfo pdf.kdiSubject, "My first Xojo output" Call pdf.SetDocInfo pdf.kdiProducer, "Xojo test application" Call pdf.SetDocInfo pdf.kdiTitle, "PDF/X Compatibility" // We want to use top-down coordinates Call pdf.SetPageCoords pdf.kpcTopDown // start a new page Call pdf.Append // Just set the trim box to the same value as the media box if no better value is known. Dim r As DynapdfRectMBS=pdf.GetBBox(pdf.kpbMediaBox) Call pdf.SetBBox(pdf.kpbTrimBox, r.Left, r.Bottom, r.Right, r.Top) // The font must be embedded (this should always be the case) Call pdf.SetFont("Times", pdf.kfsItalic, 20.0, true, pdf.kcpUnicode) // set CMYK cyan color Call pdf.SetColorSpace(pdf.kcsDeviceCMYK) Call pdf.SetFillColor(DynaPDFMBS.CMYK(255, 0, 0, 0)) // let's write some text on the page Call pdf.WriteFText(pdf.ktaCenter, "A very simple PDF/X compliant PDF file...") Call pdf.EndPage // The PDF version should be set before the file is closed because // it can be changed when importing a PDF file. Call pdf.SetPDFVersion(pdf.kpvPDFX1a_2001) // or newer one 'Call pdf.SetPDFVersion(pdf.kpvPDFX1a_2003) // add a ICC profile as output intent Dim profilefile As FolderItem = SpecialFolder.Desktop.Child("Generic CMYK Profile.icc") Call pdf.AddOutputIntent(profilefile) Call pdf.CloseFile // show the PDF f.Launch

Please let us know if you have questions.

03 04 24 - 13:19