XSaveOptions WritePageSeparator Property. The delegate called to write the page separator for export. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Value Read Only Description
[C#]XSaveOptions.PageSeparatorMethod

[Visual Basic]
XSaveOptions.PageSeparatorMethod
null No The delegate called to write the page separator for export.

 

   

Notes
 

This delegate is called during HTML export.

If it is null, a default page separator is produced for each page. You can customize the page separator by setting this property.

The definition of the XSaveOptions.PageSeparatorMethod delegate is as follows.

[C#]
delegate void PageSeparatorMethod(int pageNum, ExportArgs e);

[Visual Basic]
Delegate Sub PageSeparatorMethod(pageNum As Integer, e As ExportArgs)

pageNum is the page number, starting with 1.

The page separator is to be written to e.Writer. e.Writer is an XmlWriter for HTML export.

 

   

Example
 

The following example shows how to customize the page separator.

[C#]
Doc theDoc = new Doc();
theDoc.Read(Server.MapPath("../mypics/sample.pdf"));
theDoc.SaveOptions.WritePageSeparator = delegate(int pageNum, XSaveOptions.ExportArgs e) {
  XmlWriter writer = (XmlWriter)e.Writer;
  if(pageNum > 1) {
    writer.WriteStartElement("hr");
    writer.WriteEndElement();
  }
  writer.WriteStartElement("div");
  writer.WriteAttributeString("align", "right");
  writer.WriteString(string.Format("Page {0}", pageNum));
  writer.WriteFullEndElement();
};
theDoc.Save(Server.MapPath("PageSeparator.htm"));
theDoc.Dispose();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Read(Server.MapPath("../mypics/sample.pdf"))
theDoc.SaveOptions.WritePageSeparator = AddressOf WriteSeparator
theDoc.Save(Server.MapPath("PageSeparator.htm"))
theDoc.Dispose()

Private Shared Sub WriteSeparator(pageNum As Integer, e As ExportArgs)
  Dim writer As XmlWriter = CType(e.Writer, XmlWriter)
  If pageNum > 1 Then
    writer.WriteStartElement("hr")
    writer.WriteEndElement()
  End If
  writer.WriteStartElement("div")
  writer.WriteAttributeString("align", "right");
  writer.WriteString(String.Format("Page {0}", pageNum))
  writer.WriteFullEndElement()
End Sub