(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. How to solve PDFcrowd convertURL method’s 40 seconds timeout limit problem
Mar 04

How to solve PDFcrowd convertURL method’s 40 seconds timeout limit problem

  • March 4, 2014

How-to-solve-PDFcrowd-convertURL-method-40-seconds-timeout-limit-problemBackground:

Client asked the developer of vteam #358 to generate HTML based Client Summary Report for monthly/yearly data; convert that report to PDF, email the report to the creator/client and all these actions should be done in one single request. The report contained numerous charts and graphs along with complete details of all orders completed by each representative of the client. A client could have more than one representative, the maximum number of representatives of a client totaled at 120. Admin could view report in browser in HTML format or email as PDF format.

Technical Challenge:

PDFcrowd provided two methods to convert HTML into PDF:

  • convertURL (http://www.google.com/); which coverts HTML on a URL to PDF
  • convertHTML ($html); which converts HTML string into PDF
    .

Tariq used first method of for generating PDF which was successful in case of normal amount of report data but started to fail for large amount of data. After the investigation, it was found that PDFcrowd imposes a time out limit of 40 seconds on data retrieval from a URL. This is a limitation of PDFcrowd and there is no way to increase the time out limit. Tariq tried the second method which was to create HTML and send to PDFcrowd for generating PDF report. He used CURL to get the HTML contents of report but was failed to get desired results because jqPlot was used to create charts. jqPlot is a client side library to create charts/graphs and CURL don’t wait for the JS to execute so charts were not generated at all.

Solution:

Tariq recoded the page using jQuery to solve the problem and made sure that the report is rendered by browser, on document, ready event grabbed HTML of the report, sent an AJAX call to PDFcrowd for generation of PDF, on success of AJAX request emailed the PDF to user/client.

Unfortunately another problem was observed; the layout of charts was disturbed because jqPlot draws charts on HTML 5 canvas elements and when that canvas elements were sent as HTML string the chart labels went missing and legends were also disturbed. To resolve this, Tariq added code to convert the charts into images and replaced canvas elements with images then sent the HTML to PDFcrowd for PDF generation and finally it worked as per Client’s requirement.

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (490)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (56)
  • Implementation Notes (148)
  • Learn More (156)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development
  • Are Agile and DevOps the same?
  • The Data Scientist’s Toolset

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com