What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To watermark an existing PDF in Ruby, use HexaPDF: create a one-page PDF containing your logo, then apply that page to the source document as a background or stamp. Use Prawn instead when you are generating the PDF yourself; use CombinePDF when you already have a watermark page and want a pure-Ruby overlay workflow. The right choice depends on whether the PDF already exists and whether the logo should appear behind or above its content.

Choose the right Ruby approach

These libraries address different stages of PDF work rather than offering interchangeable ways to edit any document.

Library Best fit Watermark workflow Important consideration
HexaPDF Applying a watermark to an existing PDF Create a watermark PDF page, then use its CLI to apply that page as a background or stamp. Its project documentation describes reading and modifying existing PDFs. Check the license terms for your distribution model.
Prawn Adding a logo while generating a new PDF Place a JPG or PNG on the page with the image method. Prawn is focused on generating PDF content; it is not the recommended first choice for editing an existing document.
CombinePDF Overlaying a watermark page already prepared as a PDF Import the logo page and append it to each target page. The documented page operator places the imported page over the target page; inspect the output for your documents.

If you have an existing PDF and a logo image, the HexaPDF route below is the most direct recommendation. If the logo is already a PDF page and you want a Ruby-level loop, the CombinePDF route may fit better.

Prepare the logo and choose its placement

Use a transparent PNG when the logo needs transparent areas. A JPG is suitable when transparency is not needed. Before processing a document batch, decide whether the watermark belongs behind page content or on top of it: background mode puts it underneath, while stamp mode puts it above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
  • Create and edit PDFs. Collaborate with ease. E-sign documents and collect signatures. Get everything done in one app, wherever you go.
  • Edit text and images without jumping to another app.
  • E-sign documents or request e-signatures on any device. Recipients don’t need to log in to e-sign.
  • Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
  • Share PDFs for collaboration. Commenting features make it easy for reviewers to comment, mark up, and annotate.
  • Background: use when the watermark should sit behind the existing page content.
  • Stamp: use when the watermark should be drawn over the existing content.
  • Size and position: set the image’s dimensions and coordinates when creating the one-page watermark PDF. Check the resulting page rather than assuming a logo’s source-image dimensions will produce the intended printed size.

Make a copy of the source PDF and work on that copy first. Rotation, transparency, annotations, forms, encryption, and incremental-update behavior can affect the result; the library documentation does not establish universal preservation of every PDF feature.

Watermark an existing PDF with HexaPDF

The workflow has two parts: use HexaPDF to make a single-page PDF from the logo, then apply that PDF to the source file. The image API supports positioning and width- or height-based sizing, and its documentation demonstrates reuse of an image resource on a canvas.

1. Create a watermark PDF from the image

Install the gem in the Ruby environment used for the task, then create a script such as make_watermark.rb. The example places a logo on a new PDF page and specifies its width; adjust the coordinates and width for your page dimensions and logo.

Rank #2
Acrobat Pro | 1-Month Subscription | PDF Software |Convert, Edit, E-Sign, Protect |Activation Required [PC/Mac Online Code]
  • Create and edit PDFs. Collaborate with ease. E-sign documents and collect signatures. Get everything done in one app, wherever you go.
  • Edit text and images without jumping to another app.
  • E-sign documents or request e-signatures on any device. Recipients don’t need to log in to e-sign.
  • Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
  • Share PDFs for collaboration. Commenting features make it easy for reviewers to comment, mark up, and annotate.
require "hexapdf"

doc = HexaPDF::Document.new
page = doc.pages.add
image = doc.images.add("logo.png")

page.canvas.image(image, at: [100, 500], width: 140)
doc.write("watermark.pdf")

Run it with ruby make_watermark.rb. The resulting watermark.pdf is the page that HexaPDF’s command uses as the watermark. The coordinate pair and width are examples, not a universal placement: inspect the page and adjust them to suit your document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Apply the watermark to the existing file

HexaPDF’s CLI command is:

hexapdf watermark -w watermark.pdf input.pdf output.pdf

Use stamp mode to place the watermark above the existing page content, or background mode to put it below. The command supports applying one or more pages from a PDF and repeating watermark pages across the input document; the exact option for setting the mode and selecting pages depends on the CLI version, so consult the installed version’s command help before adding flags to an automated script. Keep the input and output paths distinct so the original remains available for comparison.

3. Check the output

Open representative pages from the generated PDF, including pages with different orientations or rotations and pages containing forms or annotations. Check that the watermark is visible at the intended size and layer, that content remains legible, and that document features you rely on still work. Do not assume a successful command alone proves every feature was preserved.

Rank #3
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
  • Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
  • EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
  • READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
  • CREATE, COMBINE, SCAN and COMPRESS PDFs.
  • FILL forms & Digitally Sign PDFs. Work with Digital certificates

Generate a new PDF with Prawn

When your Ruby program is creating the PDF, Prawn can place an image directly on its page. Its image API documents JPG and PNG support. This example generates a new PDF rather than editing an existing one:

require "prawn"

Prawn::Document.generate("report.pdf") do |pdf|
  pdf.text "Example report"
  pdf.image "logo.png", at: [100, 500], width: 140
end

Run the script in an environment with the Prawn gem installed and the image file at the given path. Change the coordinates and width to suit the page. If the existing PDF must be retained and watermarked, use the HexaPDF workflow instead of treating this generation example as an editing method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Overlay a prepared watermark page with CombinePDF

When watermark.pdf already contains the logo page, CombinePDF documents importing that page and appending it to each page in the target PDF. The documented pattern is:

Rank #4
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
require "combine_pdf"

pdf = CombinePDF.load("input.pdf")
company_logo = CombinePDF.load("watermark.pdf").pages[0]

pdf.pages.each do |page|
  page << company_logo
end

pdf.save("output.pdf")

This overlays the imported page on each page in the document. Prepare the watermark page at an appropriate size and position before applying it; inspect the saved file to confirm the visual result. As with the other routes, test annotations, rotations, forms, encryption, and other document features that matter to your workflow.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a Ruby PDF-watermarking library, so it does not replace the PDF workflows above. It may help if the asset you need is a clean screenshot of a web page before you place that image into a PDF. One GET request returns a screenshot or PDF; for an image response, for example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 shots per month with no card, and paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common problems

  • The logo is missing: check the image path and that the script can read the file. Confirm that the watermark PDF was created and contains the expected page before applying it.
  • The logo is in front of text when it should be behind: choose background mode rather than stamp mode. If it should cover existing content, use stamp mode.
  • The logo is too large, too small, or misplaced: change the image width or its coordinates when creating the watermark PDF, regenerate that PDF, and apply it again. Inspect the output at the size at which it will be used.
  • The logo has an opaque box: use a PNG that actually contains transparency. JPG does not provide transparent areas.
  • Pages do not all look alike: check page rotation and dimensions, then review representative pages individually. The documented commands do not establish automatic handling that will make every differently oriented page look identical.
  • A protected file fails or behaves unexpectedly: determine whether it is encrypted and whether your workflow can process it. The cited documentation does not promise universal support or preservation for encrypted PDFs.
  • Annotations, forms, or other content changes: test a copy and verify the document features your users need. Do not treat successful image placement as evidence that all interactive or structural PDF content survived unchanged.
  • The CLI command is unavailable: confirm HexaPDF is installed in the same Ruby environment and that its executable is available to your shell. Check the installed command’s help for syntax and supported flags.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and licensing considerations

The available documentation establishes the workflow and APIs, but does not give a stable throughput benchmark, file-size estimate, or compatibility percentage. Measure runtime and output size using representative PDFs in your target Ruby environment before setting batch expectations. For reliability, keep the original file, write to a separate output, and validate a sample of pages after each change to the logo, options, or library environment.

Best Value
PDF Director 3 PLUS - Edit, Convert, Redact, Protect PDFs, Fill Forms for Win 11, 10, 8.1, 7
  • Full-featured PDF Editor: Edit text in the document
  • Fully convert PDF to Word and Excel and continue editing
  • NEW: Further development of existing functions
  • NEW: Even faster and more user-friendly
  • NEW: Over 75 small improvements in all areas

HexaPDF’s project documentation describes AGPL and commercial licensing options. If you distribute proprietary software that includes it, review the current terms and determine which license applies to your use before deployment. Gem APIs and versions can change, so confirm the command help and API behavior for the version installed in your application.

Which method should you use?

  • Existing PDF plus image logo: create a one-page watermark PDF with HexaPDF, then apply it as a background or stamp with the CLI.
  • New PDF generated in Ruby: place the JPG or PNG with Prawn’s image method while generating the page.
  • Existing PDF plus prepared PDF watermark page: import the page with CombinePDF and append it to each target page.

Frequently Asked Questions

Can Prawn add a watermark to an existing PDF?

Prawn is focused on generating PDF content. For an existing document, the recommended route here is HexaPDF; Prawn is appropriate when you are generating the PDF yourself.

Can I place the watermark behind the PDF content?

Yes. HexaPDF’s watermark command supports background mode for placement below content and stamp mode for placement above it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does this guarantee that annotations, forms, and encryption are preserved?

No universal preservation guarantee is established. Test copies of representative documents and verify the features your workflow depends on.

Quick Recap

Bestseller No. 1
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Edit text and images without jumping to another app.; Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
$239.88
Bestseller No. 2
Acrobat Pro | 1-Month Subscription | PDF Software |Convert, Edit, E-Sign, Protect |Activation Required [PC/Mac Online Code]
Acrobat Pro | 1-Month Subscription | PDF Software |Convert, Edit, E-Sign, Protect |Activation Required [PC/Mac Online Code]
Edit text and images without jumping to another app.; Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
$29.99
Bestseller No. 3
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.; EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
$99.99
Bestseller No. 4
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 5
PDF Director 3 PLUS - Edit, Convert, Redact, Protect PDFs, Fill Forms for Win 11, 10, 8.1, 7
PDF Director 3 PLUS - Edit, Convert, Redact, Protect PDFs, Fill Forms for Win 11, 10, 8.1, 7
Full-featured PDF Editor: Edit text in the document; Fully convert PDF to Word and Excel and continue editing
$29.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.