PDF Viewer
How PDF Viewer Works
The PDF Viewer feature allows customers to preview PDF files before downloading them. This is useful for ebooks, guides, catalogs, and other PDF content where customers want to see what they're getting.
When PDF Viewer is enabled for a PDF file:
- A "View PDF" button appears alongside the download button
- Clicking "View PDF" opens the PDF in Google Docs Viewer
- Customers can browse the PDF in their browser
- They can still download the PDF using the download button
Enable PDF Viewer
PDF Viewer can be enabled globally or per-product.
Enable Globally
To enable PDF Viewer for all PDF files:
- Go to WP Enhanced > Free Download Woo
- Click PDF Settings in the sidebar
- Check Enable PDF Viewer
- Save changes
Once enabled, all PDF files will have a "View PDF" button.
Enable Per-Product
To enable PDF Viewer for specific products only:
- Edit the product in WooCommerce
- Scroll to the Free Downloads settings box (right sidebar)
- Check Enable PDF Viewer for this product
- Update the product
The per-product setting overrides the global setting. If global is disabled but per-product is enabled, the PDF viewer will show for that product.
Customizing PDF Viewer Button
You can customize the text and appearance of the "View PDF" button.
Change Button Text
- Go to WP Enhanced > Free Download Woo, then click PDF Settings in the sidebar
- Find Link/Button Text (under Display Options)
- Enter your custom text (default: "Download PDF")
- Save changes
Example Custom Button Text
- "Preview PDF"
- "Read Online"
- "View in Browser"
- "Preview Before Download"
- "Browse PDF"
Style the Button
The PDF viewer button uses the same styling as download buttons:
- Button classes: Go to WP Enhanced > Free Download Woo, click General in the sidebar, then set Button classes
- Button CSS: Go to WP Enhanced > Free Download Woo, click General in the sidebar, then set Button CSS
The button automatically inherits your theme's button styles.
Google Docs Viewer
The PDF Viewer uses Google Docs Viewer to display PDFs.
How It Works
- Customer clicks "View PDF"
- Opens Google Docs Viewer in a new tab
- Google fetches and renders your PDF
- Customer can browse, zoom, and navigate
- No download required to view
Google Docs Viewer Features
- ✅ View PDFs without downloading
- ✅ Zoom in and out
- ✅ Navigate pages
- ✅ Works on all devices
- ✅ No plugins required
- ✅ Free to use
Limitations
- ❌ Requires internet connection
- ❌ PDF must be publicly accessible
- ❌ Google servers must be able to access your file
- ❌ May not work with very large PDFs (>10MB)
- ❌ Some PDF features may not render perfectly
PDF Viewer with Multiple Files
When a product has multiple PDF files:
Links Display Method
Each PDF link gets its own "View PDF" button:
📄 Chapter-1.pdf [Download] [View PDF]
📄 Chapter-2.pdf [Download] [View PDF]
📄 Chapter-3.pdf [Download] [View PDF]
Button + Links Method
Individual PDF links have "View PDF" buttons, and the "Download All" button creates a ZIP:
[Download All (.ZIP)]
📄 Chapter-1.pdf [Download] [View PDF]
📄 Chapter-2.pdf [Download] [View PDF]
Other Display Methods
- Button Only: No PDF viewer (downloads ZIP)
- Button + Checkboxes: Individual PDFs have viewer buttons
- Button + Filenames: No PDF viewer (just lists filenames)
Use Cases
Ebooks and Guides
Allow customers to preview your ebook before downloading:
- See the table of contents
- Read the first few pages
- Check formatting and quality
- Decide if it's what they need
Catalogs and Brochures
Let customers browse your catalog online:
- View products without downloading
- Quick reference for mobile users
- Reduce unnecessary downloads
- Better user experience
Documentation
Provide online access to documentation:
- Quick reference without download
- Search within the PDF
- Share specific pages
- Mobile-friendly viewing
Course Materials
Preview course content:
- See lesson structure
- Check content quality
- Review before committing
- Accessible on any device
Privacy and Security Considerations
Public Accessibility
For Google Docs Viewer to work:
- PDFs must be publicly accessible
- No authentication required to access the file
- Google servers must be able to fetch the file
Do not use PDF Viewer for sensitive or private content. The PDF must be publicly accessible for Google to display it.
Login Requirements
If you have "Require login to download" enabled:
- The "View PDF" button still appears
- But the PDF URL must be publicly accessible for Google Viewer
- Consider disabling PDF Viewer for login-required products
Membership Restrictions
If using WooCommerce Memberships:
- PDF Viewer may not work with restricted content
- The PDF file itself must be publicly accessible
- Consider disabling PDF Viewer for members-only content
Technical Details
Supported File Types
PDF Viewer only works with PDF files:
- ✅
.pdffiles - ❌ Other document types (DOC, DOCX, etc.)
- ❌ Images
- ❌ Archives
File Size Limits
Google Docs Viewer has limitations:
- Recommended: Under 10MB
- Maximum: Around 25MB (unofficial limit)
- Larger files may fail to load or timeout
URL Requirements
For PDF Viewer to work:
- PDF must have a direct URL
- URL must be publicly accessible
- No authentication or cookies required
- HTTPS recommended but not required
Browser Compatibility
Google Docs Viewer works in:
- ✅ Chrome, Firefox, Safari, Edge
- ✅ Mobile browsers (iOS, Android)
- ✅ All modern browsers
- ❌ Very old browsers (IE 6-8)
Troubleshooting PDF Viewer
"View PDF" Button Not Appearing
If the button doesn't show:
- ✅ Verify PDF Viewer is enabled (globally or per-product)
- ✅ Check the file is actually a PDF (
.pdfextension) - ✅ Ensure the file is attached to the product
- ✅ Clear browser and server cache
- ✅ Check for JavaScript errors
PDF Doesn't Load in Viewer
If clicking "View PDF" doesn't work:
- ✅ Verify PDF URL is publicly accessible
- ✅ Check file size (should be under 10MB)
- ✅ Test the PDF URL directly in browser
- ✅ Ensure no authentication is required
- ✅ Check if file is corrupted
PDF Loads But Looks Wrong
If the PDF displays incorrectly:
- ✅ Check the original PDF file
- ✅ Verify PDF isn't corrupted
- ✅ Try a different PDF viewer to confirm
- ✅ Consider PDF complexity (some features may not render)
- ✅ Check file size and compression
Viewer Opens But Shows Error
If Google Docs Viewer shows an error:
- "No preview available": File may be too large or inaccessible
- "Sorry, we can't display this file": File may be corrupted or unsupported
- Timeout: File is too large or server is slow
Solutions:
- Reduce PDF file size
- Ensure PDF is publicly accessible
- Check server response time
- Try a different PDF
Alternatives to Google Docs Viewer
If Google Docs Viewer doesn't meet your needs, consider:
PDF.js
An open-source PDF viewer that runs entirely in the browser:
- No external dependencies
- Works offline
- Better privacy
- Requires custom implementation
PDF Embedder Plugin
WordPress plugins for embedding PDFs:
- PDF Embedder (free and pro versions)
- PDF Viewer (free)
- Embed PDF Viewer (free)
These plugins offer more control but require additional setup.
Custom Implementation
For developers, you can customize the PDF viewer:
- Use the
somdn_pdf_viewer_urlfilter to change the viewer - Implement your own PDF viewer
- Use PDF.js or other libraries
- See Advanced: Filters for details
Best Practices
When to Use PDF Viewer
✅ Use PDF Viewer when:
- Content is not sensitive or private
- PDFs are under 10MB
- You want to reduce unnecessary downloads
- Customers benefit from previewing
- Content is suitable for online viewing
❌ Don't use PDF Viewer when:
- Content is private or sensitive
- PDFs are very large (>10MB)
- Login or membership is required
- PDF contains sensitive information
- You want to force downloads
Optimizing PDFs for Viewer
- Compress PDFs: Use tools like Adobe Acrobat or online compressors
- Reduce file size: Optimize images within PDFs
- Test viewing: Always test PDFs in Google Docs Viewer
- Provide alternatives: Always offer a download option
- Consider mobile: Ensure PDFs are mobile-friendly
User Experience
- Clear labeling: Use clear button text like "View PDF" or "Preview"
- Both options: Offer both view and download buttons
- Set expectations: Mention file size in product description
- Test regularly: Ensure viewer is working properly
- Monitor feedback: Listen to customer feedback about viewing experience
What's Next
- Single File Downloads - Configure single file display
- Multiple File Downloads - Handle multiple PDFs
- Display Options - Customize button appearance
- Settings Reference - Complete settings guide
- Advanced: Filters - Customize PDF viewer behavior