Hướng dẫn how do you make an html pdf? - làm thế nào để bạn tạo một pdf html?

Chuyển đổi các trang web hoặc tệp HTML thành tài liệu PDF

Các tập tin vẫn riêng tư. Tự động xóa sau 2 giờ. Dịch vụ miễn phí cho các tài liệu lên tới 50 MB và 3 nhiệm vụ mỗi giờ. Dịch vụ chuyên nghiệp cho các tài liệu lên đến 100 MB
Free service for documents up to 50 Mb and 3 tasks per hour.
PRO service for documents up to 100 Mb

Tiện ích mở rộng trình duyệt 'Lưu dưới dạng PDF'

Chuyển đổi bất kỳ trang web nào sang PDF với dấu trang này cho trình duyệt của bạn

1 Nhấn Ctrl+Shift+B để hiển thị thanh đánh dấu. Press Ctrl+Shift+B to show the Bookmarks bar.

2 Kéo nút bên dưới vào thanh dấu trang của trình duyệt của bạn. Drag the button below to your browser's Bookmarks Bar.

3 Bạn đã xong! Bây giờ tải một trang web trong trình duyệt của bạn và nhấp vào dấu trang 'Lưu dưới dạng PDF' để chuyển đổi nó thành tài liệu PDF. You're done! Now load a web page in your browser and click the 'Save as PDF' bookmark to convert it to a PDF document.

Cách chuyển đổi HTML thành PDF

Dưới đây chúng tôi chỉ ra cách chuyển đổi các trang web sang tài liệu PDF

Bước 1: Dán URL trang web của bạn

Nhiều trang web có thể được chuyển đổi tại một thời điểm. Dán từng URL trên một dòng riêng biệt.

Bước 2: Lưu kết quả PDF

Nhấp vào Convert HTML to PDF và đợi cho đến khi xử lý hoàn tất. Sau đó nhấn Download và lưu tài liệu PDF của bạn.

Cách thêm liên kết 'Lưu vào PDF' vào trang web của bạn


Có một trang web? Hãy để khách truy cập của bạn lưu các trang của trang web của bạn dưới dạng PDF

Nhiều lần, chúng tôi đã phải đối mặt với vấn đề lưu một trang web cụ thể hoặc bất kỳ yếu tố cụ thể trực tuyến nào cần lưu dưới dạng tệp PDF trong khi sử dụng trình duyệt. Trong trường hợp đó, chúng tôi đã sử dụng tiện ích mở rộng của bên thứ 3 hoặc bất kỳ ứng dụng hoặc công cụ nào để tạo nó thành tệp PDF. Trong bài viết này, chúng tôi sẽ học cách thiết kế tệp PDF do thời gian chạy qua HTML. Nhiệm vụ này có thể đạt được theo 3 cách: & NBSP; & nbsp;

  • In trang web cụ thể và lưu nó dưới dạng pdf
  • Sử dụng thư viện JSPDF
  • Sử dụng thư viện HTML2PDF

Hãy để hiểu tất cả 3 khái niệm từng người một với sự trợ giúp của các ví dụ.

1. dấu lại phần tử cụ thể và lưu nó dưới dạng PDF:

Chúng tôi sẽ tạo ra một cửa sổ và lưu cái này dưới dạng PDF trong thời gian chạy. Điều này tương tự như các tính năng in mặc định của hệ thống. Các bước được thảo luận dưới đây.

  • Tạo một cửa sổ mới bằng phương thức ‘window.open.window.open‘ method.
  • Viết InsideHtml cho thẻ của chúng tôi, bên trong cửa sổ đó.
  • In cửa sổ
  • Đóng cửa sổ

Ví dụ: Trong ví dụ này, chúng tôi sẽ sử dụng liên kết CDN HTML2PDF sẽ giúp tạo tệp PDF.In this example, we will use the html2pdf CDN link that will help to generate the pdf file.

HTML

<!DOCTYPE html>

<html lang="en"

<Download0>

Download2<Download4 Download5=

Download2Download8Download4>

Download2<<!DOCTYPE html>3>

<!DOCTYPE html>5<!DOCTYPE html>6

<!DOCTYPE html>7<!DOCTYPE html>8

<!DOCTYPE html>7<0

<!DOCTYPE html>7<2

<!DOCTYPE html>7<4

<!DOCTYPE html>7<6

<!DOCTYPE html>7<8

<!DOCTYPE html>5html0

<!DOCTYPE html>5html2

<!DOCTYPE html>7html4

<!DOCTYPE html>7html6

<!DOCTYPE html>7html8

<!DOCTYPE html>7lang0

<!DOCTYPE html>7lang2

<!DOCTYPE html>7lang4

<!DOCTYPE html>7lang6

<!DOCTYPE html>5html0

<!DOCTYPE html>5=0

<!DOCTYPE html>7=2

<!DOCTYPE html>7=4

<!DOCTYPE html>7=6

<!DOCTYPE html>7=8

<!DOCTYPE html>7"en"0

<!DOCTYPE html>5html0

<!DOCTYPE html>5"en"4

<!DOCTYPE html>7"en"6

<!DOCTYPE html>7"en"8

<!DOCTYPE html>5html0

Download2Download8<!DOCTYPE html>3>

Download8Download0>

<>9>

Download2<<3 <4=<6>

Các

Các

Download35Download58

<!DOCTYPE html>7<Download25>

Download27<Download29>

Download31<Download33>

Download35Download36

Download35Download38

Download31Download8Download33>

Download27Download8Download29>

Download27<Download29>

Download31<Download33>

Download35Download56

Download35Download58

Download31Download8Download33>

Download27Download8Download29>

<!DOCTYPE html>7Download8Download25>

<!DOCTYPE html>5Download8<3>

Download2Download8<3>

Download8>9>

<Download4>

Download2Download86

Download2Download88

Download2Download90

<!DOCTYPE html>5Download92

Download27Download94

<!DOCTYPE html>5Download96

<!DOCTYPE html>5Download98

<!DOCTYPE html>5<!DOCTYPE html>00

<!DOCTYPE html>5<!DOCTYPE html>02

<!DOCTYPE html>5<!DOCTYPE html>04

<!DOCTYPE html>5<!DOCTYPE html>06

Download2<!DOCTYPE html>08

Download8Download4>

Download8html>

Output:

Hướng dẫn how do you make an html pdf? - làm thế nào để bạn tạo một pdf html?

2. Sử dụng thư viện JSPDF:

Để tạo PDF trong thời gian chạy, chúng tôi có thể sử dụng thư viện JSPDF. Các bước là:

  • Bao gồm CDN JSPDF trong thẻ trong tài liệu HTML. CDN được đưa ra dưới đây, tìm kiếm ‘JSPDF CDN tại Google cho phiên bản mới nhất.
  • Tạo PDF từ HTML Div bằng phương thức ‘Fromhtml.
  • Lưu tệp bằng phương thức Save () trong JavaScript.

Example:

HTML

<!DOCTYPE html>

<html>

<Download0>

Download2<<!DOCTYPE html>24<!DOCTYPE html>25<!DOCTYPE html>24>

<!DOCTYPE html>5<Download4 Download5=

<!DOCTYPE html>5Download8Download4>

Download2<<!DOCTYPE html>3>

<!DOCTYPE html>5<!DOCTYPE html>6

<!DOCTYPE html>7<!DOCTYPE html>8

<!DOCTYPE html>7<0

<!DOCTYPE html>7<2

<!DOCTYPE html>7<4

<!DOCTYPE html>7<6

<!DOCTYPE html>7<8

<!DOCTYPE html>5html0

<!DOCTYPE html>5<!DOCTYPE html>58

<!DOCTYPE html>7html4

<!DOCTYPE html>7html6

<!DOCTYPE html>7html8

<!DOCTYPE html>7lang0

<!DOCTYPE html>7lang2

<!DOCTYPE html>7lang4

<!DOCTYPE html>7lang6

<!DOCTYPE html>5html0

<!DOCTYPE html>5=0

<!DOCTYPE html>7=2

<!DOCTYPE html>7=4

<!DOCTYPE html>7=6

<!DOCTYPE html>7=8

<!DOCTYPE html>7"en"0

<!DOCTYPE html>5html0

<!DOCTYPE html>5"en"4

<!DOCTYPE html>7"en"6

<!DOCTYPE html>7"en"8

<!DOCTYPE html>5html0

Download2Download8<!DOCTYPE html>3>

Download8Download0>

<>9>

Download2<<3 <4=<6>

Các

<!DOCTYPE html>5<<3 Download01=Download15>

<!DOCTYPE html>7<Download19Download20Download19>

<!DOCTYPE html>7<Download25>

Download27<Download29>

Download31<Download33>

Download35Download36

Download35Download38

Download31Download8Download33>

Download27Download8Download29>

Download27<Download29>

Download31<Download33>

Download35Download56

Download35Download58

Download31Download8Download33>

Download27Download8Download29>

<!DOCTYPE html>7Download8Download25>

<!DOCTYPE html>5Download8<3>

Download2Download8<3>

Download2<Download4>

<!DOCTYPE html>5Download86

<!DOCTYPE html>5Download90

<!DOCTYPE html>7html01

<!DOCTYPE html>7html03

<!DOCTYPE html>7html05

<!DOCTYPE html>7html07

<!DOCTYPE html>7html09

<!DOCTYPE html>5<!DOCTYPE html>08

Download2Download8Download4>

Download8>9>

Download8html>

Output:

Hướng dẫn how do you make an html pdf? - làm thế nào để bạn tạo một pdf html?

3. Sử dụng thư viện HTML2PDF:

Các bước để tạo tệp PDF bằng thư viện HTML2PDF là:

  • Bao gồm CDN HTML2PDF ở đầu tài liệu HTML. CDN được đưa ra dưới đây, tìm kiếm ‘HTML2PDF CDN, tại Google cho phiên bản mới nhất.
  • Tạo PDF bằng cách sử dụng đối tượng HTML2PDF (). Đây là một đối tượng mặc định của thư viện HTML2PDF.
  • Lưu PDF.

Example:

HTML

<!DOCTYPE html>

<!DOCTYPE html>5<Download4 Download5=

<!DOCTYPE html>7<4

<!DOCTYPE html>7"en"8

Download2Download8Download4>

Download2<<!DOCTYPE html>3>

<!DOCTYPE html>5<!DOCTYPE html>6

<!DOCTYPE html>7<!DOCTYPE html>8

<!DOCTYPE html>7<0

<!DOCTYPE html>7<2

<!DOCTYPE html>7<4

<!DOCTYPE html>7<6

<!DOCTYPE html>7<8

<!DOCTYPE html>5html0

<!DOCTYPE html>5html2

<!DOCTYPE html>7html4

<!DOCTYPE html>7html6

<!DOCTYPE html>7html8

<!DOCTYPE html>7lang0

<!DOCTYPE html>7lang2

<!DOCTYPE html>7lang4

<!DOCTYPE html>7lang6

Download2<<3 <4=<6>

<!DOCTYPE html>5=0

<!DOCTYPE html>7=2

<!DOCTYPE html>7=4

<!DOCTYPE html>7=6

<!DOCTYPE html>7=8

<!DOCTYPE html>7"en"0

<!DOCTYPE html>5html0

<!DOCTYPE html>5"en"4

<!DOCTYPE html>7"en"6

<!DOCTYPE html>7"en"8

<!DOCTYPE html>5html0

Download2Download8<!DOCTYPE html>3>

Download8Download0>

<>9>

Download2<<3 <4=<6>

Các

<!DOCTYPE html>5<<3 Download01=Download15>

<!DOCTYPE html>7<Download19Download20Download19>

<!DOCTYPE html>7<Download25>

Download27<Download29>

Download31<Download33>

Download35Download36

Download35Download38

Download31Download8Download33>

Download27Download8Download29>

Download27<Download29>

Download31<Download33>

Download35Download56

Download35Download58

Download31Download8Download33>

Download27Download8Download29>

<!DOCTYPE html>7Download8Download25>

<!DOCTYPE html>5Download8<3>

Download2Download8<3>

Download2<Download4>

<!DOCTYPE html>5Download86

<!DOCTYPE html>5Download88

<!DOCTYPE html>5Download90

<!DOCTYPE html>7=10

<!DOCTYPE html>5<!DOCTYPE html>08

Download2Download8Download4>

Download8>9>

Download8html>

Output:

Hướng dẫn how do you make an html pdf? - làm thế nào để bạn tạo một pdf html?