Convert - GLTF/STL/OBJ file formats to U3D file for PDF page - pdf

I am trying to add three.js based 3D objects to a PDF page. It seems there are no direct exporters available to do that. So I am trying to do the below thing,
Convert the gltf/stl/obj files to U3D files
Add the .u3d file to PDF page.
I am trying to do the below process and I am not sure whether this approach is possible. It will be a great help if there is any support available to do any one of the below conversions. Also if you know any other possible approaches, kindly update me!!
Input formats output format
GLTF
OBJ U3D
STL
(any
three.js supported
3D formats)
Thanks.

There are few options available to export the three.js graphics to a PDF ( static content not a dynamic U3D assets)
Static contents
Get the rendered data from the three.js webGL renderer / canvas renderer using toDataURL("image/jpeg"), change the MIME type to JPG/PNG and add the resulting stream as an image to PDF ( this worked for me)
example - https://plnkr.co/edit/Ty8BZaDcflCJH5tH?preview
Like the above approach we can use three.js svgrenderer to export the renderer contents into a SVG data stream, which can be added into the PDF ( textures, mesh may not be 100% reproduced)
The legacy API - "threejs-pdf-renderer" can be used to directly export the three.js animations to a PDF. We don't need any other dependencies to create the PDF. But this is a legacy API which uses legacy three.js version, lot of effort needs to be done to make the API to be compatible with the latest three.js version.
example - https://satheeshks10.github.io/ThreejsPDFGenerator/
Dynamic 3D contents
We can export the three.js animations into a U3D file (no direct support is available as for now), this U3D file can be directly embedded into PDF.
example - https://tetra4d.com/pdf-samples/

Related

Generate jpeg-YCbCr tiles in geotiff file with jfif format instead pure jpeg format

Currently, my app creates GeoTiff tiled files using following options:
PROFILE=GeoTIFF
TILED=YES
BLOCKXSIZE=xxx
BLOCKYSIZE=xxx
COMPRESS=JPEG
PHOTOMETRIC=YCBCR
JPEG_QUALITY=xx
However, some apps that use my served tiles do not work due to "invalid" JFIF format.
How can I force gdal to ensure JFIF format in GeoTiff tiles?
See my own answer in https://gis.stackexchange.com/questions/426732/generate-jpeg-ycbcr-tiles-in-geotiff-file-with-jfif-format-instead-pure-jpeg-for/428023#428023.
Basically, solution involves gdal code modifications

How to render the data from .mvt or .vector.pbf file from scratch?

I signed up for the Mapbox vector tiles service and I've noticed that they provide map data in .mvt and .vector.pbf formats.
I tried to open these files with normal text editor and read them with the intention to see the structure and find a way to draw some parts of a map with javascript/html drawing functions. However , the files data seems unreadable for me.
How can I parse these files , and how can I draw simple map with their content ? (I read the .MVT specs here https://docs.mapbox.com/vector-tiles/specification , but I couldn't find any solution)
Note that I want to do it from scratch , without using mapbox-js or Leaflet libraries.

Is it possible to convert fabricjs svg output to pdf without rasterizing?

We are building a web app where the user can make a design by using fabric.js and at the end he should receive a pdf file with his work.
At first, we tried to use JSPDF because it was prefered to have a cliente-side solution. However by doing pdf.addImage(canvas.toDataURL(),...) we are rasterizing the design.
In second place, we tried server side solution using WKHTMLTOPDF, sending canvas.toSVG(), but there are some issues with fonts and shapes rendering.
The designs are complex as they can have text, shapes, images and svg.
We also tried INKSCAPE (inkscape --without-gui --export-pdf ...), MPDF and MUPDF without good results. IMAGEMAGICK is not a solution has it also rasterize the design.
The main goal is to get a vector pdf, where it's possible to increase size and where the elements of the design are selectable, and if possible that pdf should be ready to print (300 dpi and cmyk)
Yes its possible using TCPDF library.
Please check this ImageSVG api for more information for converting SVG to PDF.
https://tcpdf.org/examples/example_058/
Export the canvas to svg and use pdflib to make the pdf.
You can find an exemple here:https://www.pdflib.com/pdflib-cookbook/graphics/starter-svg/

Convert three.js to Adobe 3D-pdf?

Is there way to convert three.hs as U3D to 3D pdf?
I want to export assembly I have as three.js to 3d pdf based on tree structure (children of children).
Is it possible?
Something opposite to Convert Adobe 3D-pdf to WebGL?
We have lately done some experiments ObjExporter (amended to also export the container colors). By the same method you can also import STL Files, but then we have not found a way to transfer the colors.
The obj/stl file are then transformed to U3D files with Meshlab.
These U3D files then can be transformed with miktex/latex into 3D pdfs(see here). The system also can run on a server with some batch script.

How to view the code behind a PDF document in IOS

I have a PDF page that I've converted into a stream:
CGPDFContentStreamRef contentStream = CGPDFContentStreamCreateWithPage(pdfPage);
How can I view that stream as an NSString? I'd like to see the code that represents the PDF.
Thanks!
It's not as easy as that. A stream can be any binary data, there might be multiple chained compression formats used. See http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf (Page 23ff) for potential formats.
Your best option is CGPDFScanner other than re-implementing a PDF parser/lexer from scratch (We did that in the commercially available PSPDFKit SDK for iOS and Android - it's complicated.)