Knowledgebase

Conas PDF a shábháil i sruth, eolaire, nó i bhfeidhm gréasáin i C#

Más mian leat fiosrú conas PDF a shábháil go tapa agus go héasca i sruth, eolaire, nó i bhfeidhmchlár gréasáin le C#, táimid ann chun cabhrú leat.

Aspose.PDF for .NET is a robust and powerful API for manipulating PDF files and performing a range of tasks such as adding, replacing, or removing text and images, adding or removing bookmarks and watermarks, splitting, merging, extracting or inserting pages, custom font handling, and much more.

Sábháil PDF i C#

Sábháil an comhad PDF i sruth le C#

Le ár n-API is féidir leat an comhad PDF cruthaithe nó curtha in eagar a shábháil go héasca i sruth trí úsáid a bhaint as forlíontáin de mhodhanna Save.

public static void SaveDocumentStream()
{
    var originalFileName = Path.Combine(_dataDir, "SimpleResume.pdf");
    var modifiedFileName = Path.Combine(_dataDir, "SimpleResumeModified.pdf");

    var pdfDocument = new Aspose.Pdf.Document(originalFileName);
    // make some manipation, i.g add new empty page
    pdfDocument.Pages.Add();
    pdfDocument.Save(System.IO.File.OpenWrite(modifiedFileName));
}

Sábháil an comhad PDF i eolaire le C#

Is féidir leat an comhad PDF a shábháil freisin i eolaire ag baint úsáide as an modh Save den rang Document. Déantar an doiciméad a shábháil de réir réamhshocraithe i bhformáid Aspose.PDF v.1.7 (*.pdf) mura soláthraíonn tú cineál an fhormáide (roghanna).

public static void SaveDocument()
{
    var originalFileName = Path.Combine(_dataDir, "SimpleResume.pdf");
    var modifiedFileName = Path.Combine(_dataDir, "SimpleResumeModified.pdf");

    var pdfDocument = new Aspose.Pdf.Document(originalFileName);
    // make some manipation, i.g add new empty page
    pdfDocument.Pages.Add();
    pdfDocument.Save(modifiedFileName);
}

Sábháil an comhad PDF i bhfeidhmchláir ghréasáin le C#

Chun an comhad PDF a shábháil i bhfeidhmchláir ghréasáin, is féidir leat na modhanna a mholamar thuas a úsáid. Tá modh forlíontach Save ag an rang Document freisin le húsáid leis an HttpResponse class .

var originalFileName = Path.Combine(_dataDir, "SimpleResume.pdf");
var pdfDocument = new Aspose.Pdf.Document(originalFileName);
// make some manipulation, i.g add a new empty page
pdfDocument.Pages.Add();
pdfDocument.Save(Response, originalFileName, ContentDisposition.Attachment, new PdfSaveOptions());

Sábháil formáid PDF/A nó PDF/X

PDF/A is an ISO-standardized version of the PDF that ensures a document can be reproduced exactly the same way, leaving your documents safe and accessible for the long term. PDF/A, unlike PDF, prohibits features unsuitable for long-term archiving, such as font linking or encryption.
Mar roimhe seo, úsáidtear an modh Save chun an comhad a stóráil, ach caithfidh an comhad a ullmhú le modh Convert.

public static void SaveDocumentAsPDFx()
{
    var pdfDocument = new Aspose.Pdf.Document("..\\..\\..\\Samples\\SimpleResume.pdf");
    pdfDocument.Pages.Add();
    pdfDocument.Convert(new PdfFormatConversionOptions(PdfFormat.PDF_X_3));
    pdfDocument.Save("..\\..\\..\\Samples\\SimpleResume_X3.pdf");
}

Táimid leat i ngach céim de d’fhorbairt
Má theastaíonn gnéithe nua agat i do tháirge Aspose.PDF reatha nó API le haghaidh formáidí comhaid nua, tá ár saineolaithe ar fáil duit. Is féidir leat forbróir(a) tiomnaithe a fhostú chun oibriú leat ar do thionscadal.
Rialaíonn an fhoireann Paid Consulting go ndéanann sí cinnte go bhfaigheann tú an luach is fearr i gcónaí.