API to add watermark in PDF

API to add watermark in PDF

prakash.muthu
Advocate Advocate
606 Views
5 Replies
Message 1 of 6

API to add watermark in PDF

prakash.muthu
Advocate
Advocate

Hi,

Looking API to add watermark content in PDF exported from AutoCAD. Which metadata to update in DWG file, so that pdf export can have the required watermarking metadata to get displayed on opening PDF.

Thank You.

0 Likes
607 Views
5 Replies
Replies (5)
Message 2 of 6

Anthony_PungitoreJFMRZ
Contributor
Contributor

If I understand correctly, you want to embed some metadata in exported PDFs, so that you can use another API to conditionally add watermarks to the PDFs.  Could you use DWGPROPS to pass the data? Can't speak for all plotters, but I believe the DWG to PDF.pc3 exports the drawing properties (DWGPROPS) by default.  I use Bluebeam and did confirm that the data was present in the Document Properties.

 

If you need to do this with code, here is a C# example of setting the default drawing properties:

 

namespace YourNamespace
{
    public class YourDrawingProps
    {
        [CommandMethod("SETDRAWINGPROPS")]
        static public void SetDrawingProps()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;

            // Set DWGPROPS (Standard)
            DatabaseSummaryInfoBuilder summaryInfoBuilder = new DatabaseSummaryInfoBuilder(db.SummaryInfo)
            {                
                Title = "YourTitle",
                Subject = "YourSubject",
                Keywords = "YourKeywords"
            };
            db.SummaryInfo = summaryInfoBuilder.ToDatabaseSummaryInfo();
        }
    }
}

 

0 Likes
Message 3 of 6

ActivistInvestor
Mentor
Mentor

Watermarks were intended to not be easily removable, which would not be the case with file properties. Windows allows you to remove file properties representing personal or identifying information very easily.

 

Why not just use a plot-only layer to display drawing content that acts as a watermark?

0 Likes
Message 4 of 6

prakash.muthu
Advocate
Advocate

Does AutoCAD provide any direct API to set watermark in PDF.

0 Likes
Message 5 of 6

ActivistInvestor
Mentor
Mentor

None that I am aware of.

 

 

0 Likes
Message 6 of 6

norman.yuan
Mentor
Mentor

While AutoCAD's PDF plotting devices (*.pc3) not providing watermark feature, other PDF plotting device might do it. Also, you do not have to get it done while AutoCAD plotting to PDF. You can use third party PDF manipulate libraries (free or commercial) to add the watermark right after the PDF file is out of AutoCAD plotting. I am sure there are plenty of PDF SDKs available.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes