SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

PDF export physical size on Mac #403

Open Eneroth3 opened 4 years ago

Eneroth3 commented 4 years ago

Not sure if this is a bug or a documentation error.

I can't get PDFs to export to a defined height on Mac. This is needed in my Scaled Perspectives2 extension to export drawings to scale.

The documentation neither specifies a unit or a data type for the imageHeight setting, but logically one of these 4 exports aught to be 10 times the height of one of the others. Yet they are all the same size.

dir = UI.select_directory
Sketchup.active_model.export(
  "#{dir}/pdf size test 1.pdf",
  imageHeight: 1
)
Sketchup.active_model.export(
  "#{dir}/pdf size test 1.0.pdf",
  imageHeight: 1.0
)
Sketchup.active_model.export(
  "#{dir}/pdf size test 10.pdf",
  imageHeight: 10
)
Sketchup.active_model.export(
  "#{dir}/pdf size test 10.0.pdf",
  imageHeight: 10.0
)

On Windows you can do the following to export a PDF to a defined size.

path = UI.savepanel("Export PDF")
path = "#{path}.pdf" unless path.end_with?(".pdf")
Sketchup.active_model.export(
  path,
  height_units: Length::Inches, # Length::Millimeter not supported.
  window_height: 20.0 # Integer and Length not supported.
)

Forum thread: https://forums.sketchup.com/t/does-the-pdf-exporter-even-accept-settings/110582/7

thomthom commented 4 years ago

@nickAtSketchUp or @hilliard-sketchup - any ideas about this one?

DanRathbun commented 4 years ago

_HilliardScott, said in post:11, topic:110582 ...

There are errors in the documentation for PDF export on Mac. The options linked to pdf export are named: image_height (not imageHeight) image_width (not imageWidth) line_weight

jinyistyle commented 4 years ago

SU-45220