GLB (GL Transmission Format) is widely used for the efficient transmission of 3D assets. However, sharing and viewing GLB files can be challenging without specialized software. On the other hand, PDF (Portable Document Format) is universally accepted and accessible on virtually any device. Therefore, converting GLB to PDF allows users to present 3D content in a simpler, more distributable format.
- 3D Files Processing API
- Convert GLB to PDF in C#
- Convert Binary glTF to Acrobat 3D PDF using cURL Command
3D Files Processing API
Aspose.3D Cloud SDK for .NET simplifies the GLB to PDF conversion process with its powerful and user-friendly API. With the ability to easily handle 3D models, this SDK provides a seamless experience for developers needing to transform GLB files into PDF documents. The SDK offers high customization, ensuring the output matches your formatting preferences while maintaining the integrity of the 3D content.
- Only supports standard U3D embedded 3D content in PDF.
- PRC and U3D with RH Mesh extension are not supported yet.
Installation
Firstly, search Aspose.3D-Cloud
in the NuGet packages manager and click the Add Package
button. Secondly, obtain your client credentials from the cloud dashboard. In case you do not have an existing account, create a free account by following the instructions specified in the Quick Start article.
Convert GLB to PDF in C#
The .NET REST API supports a wide range of 3D formats, making it versatile for various file transformations, but let’s explore the details on how to accomplish the GLB to PDF using C# .NET.
ThreeDCloudApi threeDCloudApi = new ThreeDCloudApi("client_credentials", clientID, clientSecret);
create an instance of ThreeDCloudApi, where we pass the Client ID and Client Secret details as arguments.
threeDCloudApi.UploadFile(inputFileName, inputStream);
Upload the input GLB file to the cloud storage.
var response = threeDCloudApi.PostConvertByFormat(inputFileName, "pdf", newFileName, null, isOverwrite: true, null);
Call the PostConvertByFormat API to convert the GLB to PDF format and save the resultant file to cloud storage.
Convert Binary glTF to Acrobat 3D PDF using cURL Command
Aspose.3D Cloud offers flexibility through its REST API, making it easy to convert GLB to PDF using simple cURL commands. This approach benefits developers looking to automate workflows or integrate conversions into their applications without extensive programming. With a single cURL request, you can convert your GLB files to PDF in just a few steps. This approach ensures quick and efficient processing for bulk operations in automated systems.
Step 1: Get Client Credentials
Firstly, we need an access token to authenticate your API requests. Use the following command to get your token:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=Your-App-SID&client_secret=Your-App-Key" \
-H "Content-Type: application/x-www-form-urlencoded"
Step 2: Upload GLB File
Once we have the token, upload the input GLB file to Aspose Cloud storage:
curl -v "https://api.aspose.cloud/v3.0/3d/storage/file/input.glb" \
-X PUT \
-H "Authorization: Bearer your_access_token" \
--data-binary @sample.glb
Step 3: GLB PDF Conversion Online
Use the following cURL command to convert the GLB to PDF format and save the output to cloud storage:
curl -v "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name={inputFile}&newformat=stlascii&newfilename={output}&IsOverwrite=false" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"
Replace inputFile
with the name of the input GLB file, output
with the name of the resultant PDF, and accessToken
with the JWT token generated above.
Binary glTF to Acrobat 3D PDF converter
We recommend using our free Binary glTF to Acrobat 3D PDF converter App built on top of Aspose.3D Cloud. This lightweight and super-efficient solution enables you to witness the amazing capabilities of 3D files processing API.
Conclusion
Converting GLB to PDF offers a practical solution for sharing 3D content in a format accessible to all. Whether you’re looking to streamline workflows or enhance collaboration, Aspose.3D Cloud SDK for .NET and its cURL-based API provide the tools needed to simplify the process. With seamless integration and powerful features, our API makes it easier than ever to handle 3D-to-2D conversions. Try it today and experience the efficiency and versatility it brings to your projects.
Useful Links
Related Article
We highly recommend visiting the following links to learn more about: