Add MarkdownToPDF and CreateInvoiceFromStructuredData samples#7
Open
datalogics-robb wants to merge 3 commits into
Open
Add MarkdownToPDF and CreateInvoiceFromStructuredData samples#7datalogics-robb wants to merge 3 commits into
datalogics-robb wants to merge 3 commits into
Conversation
Rewrite of the .NET MarkdownToPDF sample using the Modern C++ interface: parses a practical Markdown subset (headings, lists, tables, code blocks, blockquotes, links, emphasis, HTML-lite), lays text out with Font::measure_text_width, and builds the logical structure tree with StructElement::add_marked_content_ref while drawing. Includes parser self-tests and the sample documents from the .NET repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rewrite of the .NET sample using the Modern C++ interface: builds a tagged PDF invoice from JSON metadata, CSV line items, a JSON style sheet, and a local PNG logo, then applies an owner-password restriction with Document::secure (AES-256). JSON and CSV are parsed by a small parser in the sample so APDFL stays the only dependency. Includes self-tests and the bundled data files from the .NET repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Also adds the missing CreateDocFromWebPage entry and corrects the DocumentConversion sample count. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites the two new DocumentConversion samples from
apdfl-csharp-dotnet-samples(PRs datalogics/apdfl-csharp-dotnet-samples#106 and #109, ported to develop-21 in #114) using the Modern C++ interface.MarkdownToPDF
Converts a practical Markdown subset directly to a newly created, tagged PDF: ATX/setext headings, emphasis with CommonMark-style flanking rules, inline code with backdrop, strikethrough, links (inline/reference/autolink/bare, drawn as working
LinkAnnotation+URIAction), ordered/unordered/task lists, fenced code blocks with language title rows and preserved indentation, blockquotes, pipe tables with per-column alignment, horizontal rules, and an HTML-lite subset normalized before parsing. Text is laid out withFont::measure_text_width; CJK wraps per character and CJK/Cyrillic/Greek fall back to installed fonts viaFont::is_text_representable.--self-testruns the parser tests without writing a PDF.CreateInvoiceFromStructuredData
Builds a tagged PDF invoice from JSON metadata, CSV line items, a JSON style sheet, and a local PNG logo (tagged
Figurewith alt text). The line-item table repeats its header on continuation pages; footers/rules/boxes are emitted as artifacts. When enabled in the metadata, the document is secured withDocument::secure(AES-256, owner password) so it can be viewed and printed but not edited. JSON/CSV parsing is a small self-contained parser, keeping APDFL the only dependency.Notes
StructTreeRoot/StructElement::add_marked_content_ref— the Modern C++ API assigns MCIDs and maintains the parent tree automatically, so the tagging code is much simpler than the .NET equivalents.<cctype>: APDFL's Library init changes the process locale, which otherwise misclassifies UTF-8 continuation bytes (this bit during development).--recursive) from the .NET MarkdownToPDF is intentionally not carried over.🤖 Generated with Claude Code