Hi,
With Aspose.3D, I am able to create a 3D scene and exported the scene to a 3D PDF file.
Our company also use Telerik Document Processing module to merge the Aspose 3D PDF into an existing PDF (we know that Aspose.PDF also has this functionality, but for some reason we have chosen for Telerik Document Processing module). It looks like the Aspose exported 3D PDF is not valid when we want to merge, it gave a NullReference error. However, another non-Aspose 3D PDF was able to be merged.
Here you can find the Aspose exported 3D PDF file:
output3D.pdf (35.2 KB)
Can you please analyze this? Thank you in advance.
Kind regards,
Phap Nguyen
@phapnguyen
This case needs to be investigated in details. Can you please share what code snippet are you using to validate the generated PDF and how you are generating the PDF file? Please share the source file and sample code snippet with us along with the information of non-Aspose API which is able to do the same functionality.
Hi Asad,
With the code below I save an Aspose 3D scene to a 3D PDF file:
Scene _scene = new Scene();
Node sphereNode = new Node(“Sphere”);
Sphere sphere = new Sphere(100, 32, 32);
sphereNode.Entity = sphere;
Material material = new PhongMaterial()
{
DiffuseColor = new Vector3(1, 0, 0),
SpecularColor = new Vector3(1, 0, 0),
Transparency = 0,
};
sphereNode.Material = material;
_scene.RootNode.AddChildNode(sphereNode);
// Set rendering mode and lighting scheme
PdfSaveOptions opt = new PdfSaveOptions();
opt.LightingScheme = PdfLightingScheme.None;
opt.RenderMode = PdfRenderMode.Wireframe;
//opt.FileFormat = FileFormat.PDF;
// Save in the PDF format
_scene.Save(@"C:\test\output3D.pdf", opt);
With the following Telerik Document Processing test code I tried to merge 2 PDF files:
using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(@“C:\Temp\Total_Output.pdf”)))
{
// Iterate through the files you would like to merge
for (int i = 0; i < 2; i++)
{
string documentName = “”;
if (i == 0)
{
// is an arbitrary PDF file
documentName = @“C:\Temp\Input.pdf”;
}
else if (i == 1)
{
// is an Aspose.3D exported 3D PDF
documentName = @“C:\Temp\output3D.pdf”;
}
// Open each of the files
using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(documentName)))
{
// Iterate through the pages of the current document
foreach (PdfPageSource pageToMerge in fileToMerge.Pages)
{
// Append the current page to the fileWriter, which holds the stream of the result file
fileWriter.WritePage(pageToMerge);
}
}
}
}
Kind regards,
Phap Nguyen
@phapnguyen
Thanks for providing the requested details. We have logged an investigation ticket as THREEDNET-1000 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.