Repository navigation
PUBLISH publishes a sheet list (.dsd): the sheets of many drawings into one PDF, a bookmark per sheet - #3580
Merged
Conversation
…to one PDF, a bookmark per sheet PUBLISH (and -PUBLISH) with a .dsd path reads the sheet list AutoCAD's and BricsCAD's PUBLISH save, and publishes its sheets in its order: - each [DWF6Sheet:<name>] names a drawing (DWG=, relative to the list's folder), a layout (Layout=, Model for model space) and optionally a named page setup of the drawing (Setup=); - [Target] Type=6 writes one PDF (DWF=), Type=5 a PDF per sheet, named after it, in the OUT= folder; other targets are refused; - [PdfOptions] CreateBookmarks=FALSE leaves the bookmarks out. The drawings open one at a time through the OPEN a script uses: rows queued at the front of the script queue, with PUBLISHNEXT between two drawings. So each sheet plots exactly as it does from its own drawing, with its own page setup, from the command line, a script or --batch (where no drawing needs to be open). A drawing that is already open is plotted as it is and stays open; one opened for the list takes no edit lease, so it leaves no lock file beside the drawing, and is closed unsaved once its sheets are plotted. Each sheet is reported with its paper size or the reason it was not published; the other sheets publish all the same, and a batch run ends with status 1. The PDF is written as the drawings go (io::pdf_publish): each drawing's rendered pages and what they use are renumbered into the output file at once; the page tree, a flat bookmark per sheet that opens its whole page, and the layer list follow at the end, and the file replaces the target only when it is complete. Layers of the same name are one optional-content group across all drawings, so a viewer's layer panel lists each once. Memory holds one drawing at a time: a real-world set of 471 sheets (A2 and A0) publishes in 20 s at 0.9 GB peak, the same as one EXPORTPDF per drawing, and every page renders identical to it. Print All's page loop takes a page setup beside each layout (plot_layout_pages) and no longer forces paper space onto Model. The new messages are in every locale's catalog; the PUBLISH wiki page describes the typed forms and sheet lists.
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.
What
PUBLISH(and-PUBLISH) with a.dsdpath publishes a sheet list: the sheets of many drawings, in the list'sorder, into one PDF with a bookmark per sheet, or into a PDF per sheet. A
.dsdis the drawing set descriptionAutoCAD's and BricsCAD's PUBLISH save and read, so existing sheet lists and the tools that write them work as they
are. Today
PUBLISHcovers the layouts of the current drawing only (#1124).Sheet list
[DWF6Sheet:<name>]per sheet:DWG=(relative to the list's folder; Windows separators accepted elsewhere),Layout=(Modelfor model space), optionalSetup=(a named page setup of the drawing to plot with instead ofthe layout's own; one imported from another drawing is refused with a message).
[Target] Type=6one PDF atDWF=;Type=5a PDF per sheet, named after the sheet, inOUT=. Other targets(plotter, DWF) are refused.
[PdfOptions] CreateBookmarks=FALSEleaves the bookmarks out; other keys are ignored.How it runs
OPENa script uses (rows queued at the front of the scriptqueue,
PUBLISHNEXTbetween two drawings), so each sheet plots exactly as it plots from its own drawing, with itsown page setup, from the command line, a script or
--batch.it leaves no lock file beside the drawing, and is closed unsaved once its sheets are plotted (plot-date fields are
stamped, nothing is saved).
layout or page setup); the other sheets publish all the same and a batch run ends with status 1.
PDF
io::pdf_publishwrites the PDF as the drawings go: each drawing's rendered pages and the objects they use arerenumbered into the output file at once; the page tree, a flat bookmark per sheet (opens its whole page,
/Fit)and the layer list follow at the end. The file replaces the target only when complete; an aborted run leaves no
partial file.
Resources/MediaBox/CropBox/Rotatefrom their old page tree before they leave it.layer once and hides it on every sheet.
the same as one
EXPORTPDF … ALLper drawing, and every page renders pixel-identical to that.Other changes
print_all_pages' loop isplot_layout_pages, which takes an optional page setup beside each layout and no longerforces paper space onto
Model. Print All behaves as before.pdf_export::render_pdf_documentreturns the renderedlopdf::Documentbefore serialisation;render_pdf_bytes_impluses it.Tests
io::dsd::tests: sections, order, relative and Windows paths, targets, bookmarks off, encodings, refusals.io::pdf_publish::tests: two documents with inherited resources become one PDF with ordered bookmarks, page sizeskept, shared layer groups, valid parents; no file without
finish, none on an empty set; escaping.app::sheet_publish::tests:--batchrun over two drawings with a missing drawing and a missing layout (reported,the rest published, status 1, drawings closed, no lock files); typed
PUBLISHwith an open drawing and aper-sheet target.