module Zugpferd::PdfEmbed

Overview

Embeds a ZUGFeRD/Factur-X CII XML into a PDF/A-3b document.

The entire PDF is generated in one libharu session with proper PDF/A-3b conformance: XMP metadata, an sRGB /OutputIntents entry, the Factur-X XMP extension namespace, and the XML attached as factur-x.xml.

xml = invoice.to_xml
Zugpferd::PdfEmbed.create(xml, "invoice.pdf") do |doc|
  page = doc.add_page
  # draw invoice layout on page...
end

Defined in:

zugpferd/pdf.cr

Constant Summary

ICC_PROFILE = File.join("/home/runner/work/zugpferd.cr/zugpferd.cr/src/zugpferd", "assets", "device_rgb.icc")

Path to the bundled sRGB ICC profile used for the PDF/A /OutputIntents.

XML_FILENAME = "factur-x.xml"

Filename required by the Factur-X specification for the embedded XML.

Class Method Summary

Class Method Detail

def self.create(xml : String, out_path : String, &) : Nil #

Creates a conformant PDF/A-3b file at out_path with xml embedded as factur-x.xml.

Yields an Hpdf::Doc so the caller can draw invoice content before the document is saved. At least one page must be added inside the block.


[View source]