HTML
JPG
PDF
XML
DOCX
PDF
Cách tạo PDF qua Cloud .NET SDK
Để tạo tài liệu PDF, chúng tôi sẽ sử dụng Aspose.PDF Cloud .NET SDK Cloud SDK này cho phép bạn dễ dàng xây dựng ứng dụng tạo, chỉnh sửa & chuyển đổi PDF dựa trên đám mây bằng C#, ASP.NET hoặc các ngôn ngữ .NET khác cho các nền tảng đám mây khác nhau. Mở NuGet trình quản lý gói, tìm kiếm Aspose.PDF Cloud và cài đặt. Bạn cũng có thể sử dụng lệnh sau từ Bảng điều khiển Trình quản lý Gói.
Lệnh từ Bảng điều khiển Trình quản lý Gói
PM> Install-Package Aspose.Pdf-Cloud
Các bước để tạo PDF bằng .NET SDK
Các nhà phát triển Aspose.PDF Cloud có thể dễ dàng tải & tạo PDF chỉ với vài dòng mã.
- Tải lên PDF.
- Truy xuất Thông tin Trang với getPageInfo().
- Trích xuất Trang PDF dưới dạng Hình ảnh.
- Tạo Canvas PDF Trống Mới với createPdfDocument().
- Chèn Hình ảnh Trích xuất vào PDF Mới.
- Xác nhận Thành công và Tải xuống.
Tạo PDF sử dụng .NET Cloud SDK
using Aspose.Pdf.Cloud.Sdk.Model;
namespace CreateDocument
{
public class CreatePdfDocument
{
public CreatePdfDocument(CrateDocumentHelper helper)
{
DocumentProperties docProps = new DocumentProperties(
List: new List<DocumentProperty>() {
new DocumentProperty(Name: "prop1", Value: "Value1", BuiltIn: false)
}
);
DisplayProperties dispProps = new DisplayProperties()
{
CenterWindow = true,
HideMenuBar = true,
Direction = Direction.L2R,
DisplayDocTitle = true,
HideToolBar = true,
HideWindowUI = true,
NonFullScreenPageMode = PageMode.UseThumbs,
PageLayout = PageLayout.TwoPageLeft,
PageMode = PageMode.UseThumbs
};
DefaultPageConfig pageConfig = new DefaultPageConfig(helper.config.PAGE_HEIGHT, helper.config.PAGE_WIDTH);
DocumentConfig document_config = new DocumentConfig(
DocumentProperties: docProps,
DisplayProperties: dispProps,
DefaultPageConfig: pageConfig,
PagesCount: helper.config.PAGES_COUNT
);
DocumentResponse response = helper.pdfApi.PostCreateDocument(helper.config.LOCAL_RESULT_DOCUMENT_NAME, document_config, folder: helper.config.TEMP_FOLDER);
if (response != null && response.Code == 200)
Console.WriteLine("Document #{0} created.", helper.config.LOCAL_RESULT_DOCUMENT_NAME);
else
Console.WriteLine("Unexpected error!!!");
}
}
}