123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Xml;
- using System.IO;
- using System.Reflection;
- using System.Text;
- namespace FastReport.Export.Pdf
- {
- internal class PDFMetaData
- {
- private XmlDocument metadata;
- private string creator;
- private string description;
- private string title;
- private string producer;
- private string keywords;
- private string createdate;
- private string documentId;
- private string instanceId;
- private string part;
- private string conformance;
- private string zugferd;
- public string MetaDataString
- {
- get
- {
- return ExportUtils.StringFormat(metadata.InnerXml, Creator, Description, Title,
- CreateDate, Keywords, Producer, DocumentID, InstanceID, part, conformance, zugferd);
- }
- }
- public string Creator
- {
- get { return creator; }
- set { creator = value; }
- }
- public string Description
- {
- get { return description; }
- set { description = value; }
- }
- public string Title
- {
- get { return title; }
- set { title = value; }
- }
- public string Producer
- {
- get { return producer; }
- set { producer = value; }
- }
- public string Keywords
- {
- get { return keywords; }
- set { keywords = value; }
- }
- public string CreateDate
- {
- get { return createdate; }
- set { createdate = value; }
- }
- public string DocumentID
- {
- get { return documentId; }
- set { documentId = value; }
- }
- public string InstanceID
- {
- get { return instanceId; }
- set { instanceId = value; }
- }
- public string Part
- {
- get { return part; }
- set { part = value; }
- }
- public string Conformance
- {
- get { return conformance; }
- set { conformance = value; }
- }
- public string ZUGFeRD
- {
- get { return zugferd; }
- set { zugferd = value; }
- }
- public PDFMetaData()
- {
- metadata = new XmlDocument();
- // get a reference to the current assembly
- Assembly a = Assembly.GetExecutingAssembly();
- // get a list of resource names from the manifest
- using (Stream stream = a.GetManifestResourceStream("FastReport.Resources.Pdf.MetaData.xml"))
- using (XmlTextReader reader = new XmlTextReader(stream))
- metadata.Load(reader);
- }
- ///
- /// <param name="filename">File name without extentions, for example "MetaDataX"</param>
- public PDFMetaData(string filename)
- {
- metadata = new XmlDocument();
- // get a reference to the current assembly
- Assembly a = Assembly.GetExecutingAssembly();
- // get a list of resource names from the manifest
- using (Stream stream = a.GetManifestResourceStream(
- ExportUtils.StringFormat("FastReport.Resources.Pdf.{0}.xml", filename)))
- using (XmlTextReader reader = new XmlTextReader(stream))
- metadata.Load(reader);
- }
- }
- }
|