C1PdfDocument

Posted by: edv on 20 October 2020, 12:23 am EST

  • Posted 20 October 2020, 12:23 am EST

    Hi;

    I am using C1.C1Pdf.C1PdfDocument to save a scanned image to pdf. It works fine.

    Example:

    Dim image As Image …

    Dim pdf As New C1.C1Pdf.C1PdfDocument()

    Dim rect As RectangleF = pdf.PageRectangle
    rect.Inflate(-5, -5)
    pdf.DrawImage(image, rect, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Clip)

    pdf.NewPage()

    pdf.Save(Filename)

    Is it possible to save the pdf-document as read only with timestamp?

    Thanks

  • Replied 20 October 2020, 10:11 pm EST

    Hi,

    To change the security properties of the document you can use the Security property of the PdfDocument to set properties like AllowCopyContent, AllowEditAnnotations, and etc (refer to this link given below). If you want to change the attributes of the saved file, first make sure you have the right to change the file attributes then you use the File class of the System.IO assembly to change the attributes like ReadOnly, LastWriteTIme, creationTime, etc using its methods.
    https://www.grapecity.com/componentone/docs/win/online-pdf/C1.C1Pdf.4.5.2~C1.C1Pdf.PdfSecurity_members.html

    For example:-

    File.SetAttributes(“filepath”,FileAttributes.ReadOnly)

    The above line of code sets the file to read-only.

    For more on File Class refer to this link -
    https://docs.microsoft.com/en-us/dotnet/api/system.io.file?view=netframework-4.8

    Hope this helps.

    Regards,
    Prabhat Sharma.
  • Marked as Answer

    Replied 20 October 2020, 11:06 pm EST

    "Security property" is exactly what I meant.

    Thank you very much.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels