Closed bergel closed 1 year ago
I have a canvas 500@500
what is the expected result? to handle that?
canvas pdfExporter fileName: 'test'; export
What should be the correct size for test.pdf
?
Because the info, resolution is 500x500
.
I read this web page then I think I can set the canvas extent in order to use inches, millimeters or pdf units.
The PPI value should be configurable, as default value I would select standard 96 PPI. So 132.291667 millimeters in this case.
What is ppi?
Roassal exporters now use https://github.com/zweidenker/Units Consider the following script with the last version of Roassal3Exporters
c := RSCanvas new.
lbls := RSGroup new.
Collection withAllSubclassesDo: [ :cls |
lbl := RSLabel new text: cls name; model: cls.
lbls add: lbl ].
c addAll: lbls.
RSNormalizer fontSize
shapes: lbls;
normalize: #numberOfMethods.
"RSHierarchyPacker on: lbls."
c @ RSCanvasController.
c @ RSHierarchyPacker.
c extent: (RSPageExtent from: 8.26 inches@ 11.69 inches).
c pdfExporter
fileName: 'test';
export.
RSPDFExporter uses unit point
to export and create the pdf file. 1 point = 1/72 inch
You will need to change the canvas extent in order to create a pdf document.
Use RSPageExtent, to correctly set the canvas extent before the export process.
You can access a default values for well known pages sizes.
RSPageExtent letter
or RSPageExtent a4
.
What do you think about it?
PPI = pixels per inch. Very nice, it would be actually great to support the units even on the canvas level so you could draw lines with explicit extents in millimetres (for example) without need to recompute.
From where the value 72 comes from?
It is an standard, I think we can not use units in roassal, because of the camera, with roassal camera you can adjust your visualization to the desire size.
Then is better use units in the canvas extent instead of each shape's coordinates
https://cairographics.org/manual/cairo-PDF-Surfaces.html#cairo-pdf-surface-create
I was also curious about the 1/72 and found interesting info in this wiki page.
May be not useful for the discussion, but I can add what I understand from the low-level PDF Cairo surface: The function caller always implicitly uses such 1/72 inch points.
For example, if you want to create an horizontal line of 1 inch in a A4 page, you can do this:
Well, I hope it doesn't darkens more than it cleans.
Roassal3 PDF now uses units, can we close this issue?
done
@pavel-krivanek said: