本文整理匯總了C#中PdfSharp.Pdf.IO.PdfWriter.WriteRaw方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfWriter.WriteRaw方法的具體用法?C# PdfWriter.WriteRaw怎麽用?C# PdfWriter.WriteRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PdfSharp.Pdf.IO.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.WriteRaw方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WriteObject
/// <summary>
/// Writes the iref section in pdf stream.
/// </summary>
internal void WriteObject(PdfWriter writer)
{
writer.WriteRaw("xref\n");
// PdfObjectID[] objectIDs2 = AllObjectIDs;
PdfReference[] irefs = AllReferences;
// PdfObjectID id1 = objectIDs2[0];
// PdfReference xref1 = irefs[0];
// id1.GetType();
// xref1.GetType();
//ArrayList list = new ArrayList(AllObjectIDs);
//list.Sort();
//list.CopyTo(objectIDs);
int count = irefs.Length;
writer.WriteRaw(String.Format("0 {0}\n", count + 1));
writer.WriteRaw(String.Format("{0:0000000000} {1:00000} {2} \n", 0, 65535, "f"));
//PdfEncoders.WriteAnsi(stream, text);
for (int idx = 0; idx < count; idx++)
{
PdfReference iref = irefs[idx];
//text = String.Format("{0} {1}\n", iref.ObjectID.ObjectNumber, 1);
//PdfEncoders.WriteAnsi(stream, text);
// Acrobat is very pedantic; it must be exactly 20 bytes per line.
writer.WriteRaw(
String.Format("{0:0000000000} {1:00000} {2} \n", iref.Position, iref.GenerationNumber, "n"));
//PdfEncoders.WriteAnsi(stream, text);
}
}
示例2: WriteXRefEnty
/// <summary>
/// Writes the object in PDF iref table format.
/// </summary>
internal void WriteXRefEnty(PdfWriter writer)
{
// PDFsharp does not yet support PDF 1.5 object streams.
// Each line must be exactly 20 bytes long, otherwise Acrobat repairs the file.
string text = String.Format("{0:0000000000} {1:00000} n\n",
this.position, this.objectID.GenerationNumber); // this.InUse ? 'n' : 'f');
writer.WriteRaw(text);
}
示例3: WriteObject
/// <summary>
/// Writes the xref section in pdf stream.
/// </summary>
internal void WriteObject(PdfWriter writer)
{
writer.WriteRaw("xref\n");
PdfReference[] irefs = AllReferences;
int count = irefs.Length;
writer.WriteRaw(String.Format("0 {0}\n", count + 1));
writer.WriteRaw(String.Format("{0:0000000000} {1:00000} {2} \n", 0, 65535, "f"));
//PdfEncoders.WriteAnsi(stream, text);
for (int idx = 0; idx < count; idx++)
{
PdfReference iref = irefs[idx];
// Acrobat is very pedantic; it must be exactly 20 bytes per line.
writer.WriteRaw(String.Format("{0:0000000000} {1:00000} {2} \n", iref.Position, iref.GenerationNumber, "n"));
}
}
示例4: WriteObject
internal override void WriteObject(PdfWriter writer)
{
// Implementet because it must be overridden.
writer.WriteRaw(" null ");
}
示例5: WriteObject
/// <summary>
/// Writes the keyword «null».
/// </summary>
internal override void WriteObject(PdfWriter writer)
{
writer.WriteBeginObject(this);
writer.WriteRaw(" null ");
writer.WriteEndObject();
}
示例6: DoSave
/// <summary>
/// Implements saving a PDF file.
/// </summary>
void DoSave(PdfWriter writer)
{
if (this.pages == null || this.pages.Count == 0)
throw new InvalidOperationException("Cannot save a PDF document with no pages.");
try
{
bool encrypt = this.securitySettings.DocumentSecurityLevel != PdfDocumentSecurityLevel.None;
if (encrypt)
{
PdfStandardSecurityHandler securityHandler = this.securitySettings.SecurityHandler;
if (securityHandler.Reference == null)
this.irefTable.Add(securityHandler);
else
Debug.Assert(this.irefTable.Contains(securityHandler.ObjectID));
this.trailer.Elements[PdfTrailer.Keys.Encrypt] = this.securitySettings.SecurityHandler.Reference;
}
else
this.trailer.Elements.Remove(PdfTrailer.Keys.Encrypt);
PrepareForSave();
if (encrypt)
this.securitySettings.SecurityHandler.PrepareEncryption();
writer.WriteFileHeader(this);
PdfReference[] irefs = this.irefTable.AllReferences;
int count = irefs.Length;
for (int idx = 0; idx < count; idx++)
{
PdfReference iref = irefs[idx];
#if DEBUG_
if (iref.ObjectNumber == 378)
GetType();
#endif
iref.Position = writer.Position;
iref.Value.WriteObject(writer);
}
int startxref = writer.Position;
this.irefTable.WriteObject(writer);
writer.WriteRaw("trailer\n");
this.trailer.Elements.SetInteger("/Size", count + 1);
this.trailer.WriteObject(writer);
writer.WriteEof(this, startxref);
//if (encrypt)
//{
// this.state &= ~DocumentState.SavingEncrypted;
// //this.securitySettings.SecurityHandler.EncryptDocument();
//}
}
finally
{
if (writer != null)
{
writer.Stream.Flush();
// DO NOT CLOSE WRITER HERE
//writer.Close();
}
}
}