DWG to PDF conversion & Block Insertion

Yes the black area is incorrect as it should be opaque not black.
2ndly, the colors of the drawing are too light so when we print it on paper it will not be understandable

3rdly, The desired result I got was when I converted via ProgeCAD using the ctb.

PS. May we connect on Zoom or Google Meets?

@oleksii.gorokhovatskyi please see my code

// I have put this file near the initial DWG
string ctbFilePath = “C:\Users\dell\Downloads\STD CTB NPCIL.ctb”;

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(“C:\Users\dell\Downloads\A0_85090_4G_13XX_TEST_PRINT.dwg”))
{
CadRasterizationOptions options = new CadRasterizationOptions();

 options.CtbSources = new Dictionary<string, Stream>
 {
      { "STD CTB NPCIL.ctb", File.OpenRead(ctbFilePath) }
 };

 // color mode is set up
 options.DrawType = CadDrawTypeMode.UseObjectColor;

 PdfOptions pdfOptions = new PdfOptions();
 pdfOptions.VectorRasterizationOptions = options;

 cadImage.Save("C:\\Users\\dell\\Downloads\\A0_85090_4G_13XX TEST PRINT2.dwg.pdf", pdfOptions);

 foreach (KeyValuePair<string, Stream> streamSource in options.CtbSources)
 {
     streamSource.Value.Dispose();
 }

 System.Console.WriteLine(cadImage.Layouts["Model"].CurrentStyleSheet);

}

I am getting output as

output.png (3.6 KB)

and the resultant pdf as
A0_85090_4G_13XX TEST PRINT2.dwg.pdf (1.7 MB)

@osmanrabbani,
The color result means CTB file was not applied successfully at all. Could you please check the result of the attached project for two cases - when DWG and CTB are located in the same folder and when they are in different (just switch from one assignment of fileName variable to another, now one of them is commented).
TestCTB.zip (782.7 KB)

Additionally, we have found that we don’t take into account now the specific of such CTB files, we have created CADNET-9890 to implement it. Could you please check the attached new result if it is more correct from your point of view.
A0_85090_4G_13XX TEST PRINT.dwg.pdf (1.7 MB)

@oleksii.gorokhovatskyi

Hi what is CADNET-9890? How can we use it?

The very last pdf you shared is the correct output we require.

@oleksii.gorokhovatskyi

" Could you please check the result of the attached project for two cases - when DWG and CTB are located in the same folder and when they are in different (just switch from one assignment of fileName variable to another, now one of them is commented). "

Hi, I checked for both cases & the result is coming as the same which is not the one that we require. I am attaching it here as well.

A0_85090_4G_13XX TEST PRINT.dwg.pdf (1.7 MB)

@osmanrabbani.
OK, so your latest result (that is grey) achieved with sample application confirms that CTB functionality works on your side at all both for CTB file in the same folder and in the different one. This is good :slight_smile:

CADNET-9890 in the identifier of the task we need to implement to bring the required functionality for you. You can see the current status of the task at the bottom of the page with this thread. This task is planned to be delivered in the upcoming Aspose.CAD for .NET 24.9 till the end of September (but I can not guarantee this according to free forum support policy). When task is ready I will post message here and you will be able to generate the result similar to my latest example.

@oleksii.gorokhovatskyi

Hi, we need this functionality for a pdf conversion utility in at the earliest for a mission critical system. We can’t compromise of the quality of the pdf via CTB because it needs to be printed at the end.

How can we achieve our desired result with what’s available right now? Please guide us.

If possible, can you provide us access to the beta version of library that you used to generate your latest example?

We will be more than happy to test it out more for you & provide you feedback. :slight_smile:

@osmanrabbani,
could you please clarify - do you have license of some type for Aspose products? Can you share the Order ID from .lic file so we can assist better?

@oleksii.gorokhovatskyi

Hi, now that sdk 24.9 has been released. Can we get the rendering of pdf based on CTB we want now?

@osmanrabbani,
Hi,
yes, try it on your side please.

Hi we are getting a good result now but it is crossed out, why?

A0_85090_4G_13XX TEST PRINT.dwg.pdf (1.7 MB)

@osmanrabbani,
Hello.
This is the restriction to use software without any license. You can get free evaluation license in Purchase Portal. Please add the products to the cart, view it, click “Proceed” and “Get a Temporary License” next.