Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TechDraw: Export layered PDF #13918

Open
2 tasks done
maxwxyz opened this issue May 9, 2024 · 6 comments
Open
2 tasks done

TechDraw: Export layered PDF #13918

maxwxyz opened this issue May 9, 2024 · 6 comments
Labels
Feature FR for improvements or new features File format: PDF WB TechDraw Related to the TechDraw Workbench

Comments

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 9, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

All commercial CAD software usually export drawing in a layered PDF format. This allows the user to hide certain layers when viewing the PDF later or extract certain layers only.

Usually they provide the following layers in this order:

  • pixelated image rendering (colors/shades)
  • hatching
  • visible lines (of the model)
  • symbols (balloons, tables, finishes,...)
  • section view lines (cutting lines and name)
  • Cosmetic geometry (incl. page drawing frame)
  • title block template
  • title block content (text/images)
  • dimensions (values and lines/arrows)

Demo:
image

With only one layer active:
image

Full version info

OS: Windows 11 build 22631
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37213 (Git)
Build type: Release
Branch: main
Hash: 20e7deb86a8c6c2cd2378f09f8313760933f3a5c
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: German/Germany (de_DE)
Installed mods: 
  * CfdOF 1.25.12
  * Curves 0.6.36
  * dodo 1.0.1
  * fasteners 0.5.20
  * freecad.gears 1.2.0
  * OpenTheme 2024.5.3
  * OpticsWorkbench 1.0.17
  * sheetmetal 0.4.13

Subproject(s) affected?

Techdraw

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added WB TechDraw Related to the TechDraw Workbench Feature FR for improvements or new features File format: PDF labels May 9, 2024
@m1cha1
Copy link

m1cha1 commented May 14, 2024

Layers (Optional Content Groups) are supported by PDF version 1.5 (by default Freecad writes to version 1.4)
The problem is that QPdfWriter does not support layers.
However, layers are supported by Scribus . Is it possible to port it to Freecad?

@tobiasfalk
Copy link
Contributor

tobiasfalk commented May 15, 2024

However, layers are supported by Scribus . Is it possible to port it to Freecad?

Could be quite hard since TD uses the QT Painter classes for all the actuall drawing(to my understanding).
This would requir to create a New QtPaint devic, witch is possible but not easy since you would also need to add much more funcunalyti to it than just painting, wich just do not exist in the Qt Painting logic.

I am not saying that it is not possible but quite hard.
For reference, just for fun I once started to look how hard it is and began a Latex Paint Device:

My trie on a Latex Paint device, devinelty not butifull😁🤦‍♂️
Explination on how Qt Painter works

@m1cha1
Copy link

m1cha1 commented May 16, 2024

Another solution is to patch QT files:
Modify Qt source code to implement PDF layered printing

@tobiasfalk
Copy link
Contributor

tobiasfalk commented May 17, 2024

Another solution is to patch QT files: Modify Qt source code to implement PDF layered printing

Looks interesting and may be a way to do it.
This would still mean to reimplement/ make a derivative of the QtPDF paint device, but this would also mean that more control over the output would be available.
This maybe would then also allow the insertion of 3D Models in to the PDF.

Some things I found about this:
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdflsdk/apireference/PD_Layer/PDOCG.html

@maxwxyz
Copy link
Collaborator Author

maxwxyz commented May 18, 2024

then this would also enable #12843

@m1cha1
Copy link

m1cha1 commented May 23, 2024

Another solution: using part of PDF4QT to generate pdf (Pdf4QtLibCore??)
License: LGPL 3.0
C++20, Qt 6.6
I'm not a programmer but I think we can use QPainter
"3D PDF support *(planned in year 2024)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature FR for improvements or new features File format: PDF WB TechDraw Related to the TechDraw Workbench
Projects
None yet
Development

No branches or pull requests

3 participants