pdfcrowd 4.2 → 4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pdfcrowd.rb +276 -39
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e59a7a19ff3225f04c9e57a42cd23e1adc55c9c
|
4
|
+
data.tar.gz: 43919e7c0f7f54d36eb05bf6fa17283b3b54339c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba102999a7f94960de507b1832c03cbbcee1e6ccdcb4f6a32923c56b4f5032770f4aff5bee2980dc3c3f668e3e39c97fab3fe39ed91c15bc378ca35ea9c5a1a7
|
7
|
+
data.tar.gz: cb2a0527640389bc4f835be24f733546c17642b3c2f54a013a909165c9ec4976941c7bd115d32b066a101593ad710e8d932331a81cfad17a49f0ccb8fca192dd
|
data/lib/pdfcrowd.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
require 'net/http'
|
25
25
|
require 'cgi'
|
26
|
+
require 'fileutils'
|
26
27
|
|
27
28
|
# ======================================
|
28
29
|
# === PDFCrowd legacy version client ===
|
@@ -529,7 +530,7 @@ end
|
|
529
530
|
module Pdfcrowd
|
530
531
|
HOST = ENV["PDFCROWD_HOST"] || 'api.pdfcrowd.com'
|
531
532
|
MULTIPART_BOUNDARY = '----------ThIs_Is_tHe_bOUnDary_$'
|
532
|
-
CLIENT_VERSION = '4.
|
533
|
+
CLIENT_VERSION = '4.3'
|
533
534
|
|
534
535
|
def self.float_to_string(value)
|
535
536
|
value.to_s.sub(',', '.')
|
@@ -544,7 +545,7 @@ module Pdfcrowd
|
|
544
545
|
|
545
546
|
setProxy(nil, nil, nil, nil)
|
546
547
|
setUseHttp(false)
|
547
|
-
setUserAgent('pdfcrowd_ruby_client/4.
|
548
|
+
setUserAgent('pdfcrowd_ruby_client/4.3 (http://pdfcrowd.com)')
|
548
549
|
|
549
550
|
@retry_count = 1
|
550
551
|
end
|
@@ -794,8 +795,14 @@ module Pdfcrowd
|
|
794
795
|
end
|
795
796
|
|
796
797
|
output_file = open(file_path, "wb")
|
797
|
-
|
798
|
-
|
798
|
+
begin
|
799
|
+
convertUrlToStream(url, output_file)
|
800
|
+
output_file.close()
|
801
|
+
rescue Error => why
|
802
|
+
output_file.close()
|
803
|
+
FileUtils.rm(file_path)
|
804
|
+
raise
|
805
|
+
end
|
799
806
|
end
|
800
807
|
|
801
808
|
# Convert a local file.
|
@@ -842,8 +849,14 @@ module Pdfcrowd
|
|
842
849
|
end
|
843
850
|
|
844
851
|
output_file = open(file_path, "wb")
|
845
|
-
|
846
|
-
|
852
|
+
begin
|
853
|
+
convertFileToStream(file, output_file)
|
854
|
+
output_file.close()
|
855
|
+
rescue Error => why
|
856
|
+
output_file.close()
|
857
|
+
FileUtils.rm(file_path)
|
858
|
+
raise
|
859
|
+
end
|
847
860
|
end
|
848
861
|
|
849
862
|
# Convert a string.
|
@@ -882,8 +895,14 @@ module Pdfcrowd
|
|
882
895
|
end
|
883
896
|
|
884
897
|
output_file = open(file_path, "wb")
|
885
|
-
|
886
|
-
|
898
|
+
begin
|
899
|
+
convertStringToStream(text, output_file)
|
900
|
+
output_file.close()
|
901
|
+
rescue Error => why
|
902
|
+
output_file.close()
|
903
|
+
FileUtils.rm(file_path)
|
904
|
+
raise
|
905
|
+
end
|
887
906
|
end
|
888
907
|
|
889
908
|
# Set the output page size.
|
@@ -899,7 +918,7 @@ module Pdfcrowd
|
|
899
918
|
self
|
900
919
|
end
|
901
920
|
|
902
|
-
# Set the output page width.
|
921
|
+
# Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
|
903
922
|
#
|
904
923
|
# * +page_width+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
905
924
|
# * *Returns* - The converter object.
|
@@ -912,7 +931,7 @@ module Pdfcrowd
|
|
912
931
|
self
|
913
932
|
end
|
914
933
|
|
915
|
-
# Set the output page height. Use -1 for a single page PDF.
|
934
|
+
# Set the output page height. Use -1 for a single page PDF. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
|
916
935
|
#
|
917
936
|
# * +page_height+ - Can be -1 or specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
918
937
|
# * *Returns* - The converter object.
|
@@ -927,8 +946,8 @@ module Pdfcrowd
|
|
927
946
|
|
928
947
|
# Set the output page dimensions.
|
929
948
|
#
|
930
|
-
# * +width+ - Set the output page width. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
931
|
-
# * +height+ - Set the output page height. Use -1 for a single page PDF. Can be -1 or specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
949
|
+
# * +width+ - Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
950
|
+
# * +height+ - Set the output page height. Use -1 for a single page PDF. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. Can be -1 or specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
|
932
951
|
# * *Returns* - The converter object.
|
933
952
|
def setPageDimensions(width, height)
|
934
953
|
setPageWidth(width)
|
@@ -1379,7 +1398,7 @@ module Pdfcrowd
|
|
1379
1398
|
self
|
1380
1399
|
end
|
1381
1400
|
|
1382
|
-
# Convert only the specified element and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
|
1401
|
+
# Convert only the specified element from the main document and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
|
1383
1402
|
#
|
1384
1403
|
# * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
|
1385
1404
|
# * *Returns* - The converter object.
|
@@ -1405,7 +1424,7 @@ module Pdfcrowd
|
|
1405
1424
|
self
|
1406
1425
|
end
|
1407
1426
|
|
1408
|
-
# Wait for the specified element in a source document. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails.
|
1427
|
+
# Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails.
|
1409
1428
|
#
|
1410
1429
|
# * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
|
1411
1430
|
# * *Returns* - The converter object.
|
@@ -1557,7 +1576,171 @@ module Pdfcrowd
|
|
1557
1576
|
self
|
1558
1577
|
end
|
1559
1578
|
|
1560
|
-
#
|
1579
|
+
# Set the title of the PDF.
|
1580
|
+
#
|
1581
|
+
# * +title+ - The title.
|
1582
|
+
# * *Returns* - The converter object.
|
1583
|
+
def setTitle(title)
|
1584
|
+
@fields['title'] = title
|
1585
|
+
self
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
# Set the subject of the PDF.
|
1589
|
+
#
|
1590
|
+
# * +subject+ - The subject.
|
1591
|
+
# * *Returns* - The converter object.
|
1592
|
+
def setSubject(subject)
|
1593
|
+
@fields['subject'] = subject
|
1594
|
+
self
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
# Set the author of the PDF.
|
1598
|
+
#
|
1599
|
+
# * +author+ - The author.
|
1600
|
+
# * *Returns* - The converter object.
|
1601
|
+
def setAuthor(author)
|
1602
|
+
@fields['author'] = author
|
1603
|
+
self
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
# Associate keywords with the document.
|
1607
|
+
#
|
1608
|
+
# * +keywords+ - The string with the keywords.
|
1609
|
+
# * *Returns* - The converter object.
|
1610
|
+
def setKeywords(keywords)
|
1611
|
+
@fields['keywords'] = keywords
|
1612
|
+
self
|
1613
|
+
end
|
1614
|
+
|
1615
|
+
# Specify the page layout to be used when the document is opened.
|
1616
|
+
#
|
1617
|
+
# * +page_layout+ - Allowed values are single-page, one-column, two-column-left, two-column-right.
|
1618
|
+
# * *Returns* - The converter object.
|
1619
|
+
def setPageLayout(page_layout)
|
1620
|
+
unless /(?i)^(single-page|one-column|two-column-left|two-column-right)$/.match(page_layout)
|
1621
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(page_layout, "page_layout", "html-to-pdf", "Allowed values are single-page, one-column, two-column-left, two-column-right.", "set_page_layout"), 470);
|
1622
|
+
end
|
1623
|
+
|
1624
|
+
@fields['page_layout'] = page_layout
|
1625
|
+
self
|
1626
|
+
end
|
1627
|
+
|
1628
|
+
# Specify how the document should be displayed when opened.
|
1629
|
+
#
|
1630
|
+
# * +page_mode+ - Allowed values are full-screen, thumbnails, outlines.
|
1631
|
+
# * *Returns* - The converter object.
|
1632
|
+
def setPageMode(page_mode)
|
1633
|
+
unless /(?i)^(full-screen|thumbnails|outlines)$/.match(page_mode)
|
1634
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(page_mode, "page_mode", "html-to-pdf", "Allowed values are full-screen, thumbnails, outlines.", "set_page_mode"), 470);
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
@fields['page_mode'] = page_mode
|
1638
|
+
self
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# Specify how the page should be displayed when opened.
|
1642
|
+
#
|
1643
|
+
# * +initial_zoom_type+ - Allowed values are fit-width, fit-height, fit-page.
|
1644
|
+
# * *Returns* - The converter object.
|
1645
|
+
def setInitialZoomType(initial_zoom_type)
|
1646
|
+
unless /(?i)^(fit-width|fit-height|fit-page)$/.match(initial_zoom_type)
|
1647
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(initial_zoom_type, "initial_zoom_type", "html-to-pdf", "Allowed values are fit-width, fit-height, fit-page.", "set_initial_zoom_type"), 470);
|
1648
|
+
end
|
1649
|
+
|
1650
|
+
@fields['initial_zoom_type'] = initial_zoom_type
|
1651
|
+
self
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
# Display the specified page when the document is opened.
|
1655
|
+
#
|
1656
|
+
# * +initial_page+ - Must be a positive integer number.
|
1657
|
+
# * *Returns* - The converter object.
|
1658
|
+
def setInitialPage(initial_page)
|
1659
|
+
if (!(Integer(initial_page) > 0))
|
1660
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(initial_page, "initial_page", "html-to-pdf", "Must be a positive integer number.", "set_initial_page"), 470);
|
1661
|
+
end
|
1662
|
+
|
1663
|
+
@fields['initial_page'] = initial_page
|
1664
|
+
self
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
# Specify the initial page zoom in percents when the document is opened.
|
1668
|
+
#
|
1669
|
+
# * +initial_zoom+ - Must be a positive integer number.
|
1670
|
+
# * *Returns* - The converter object.
|
1671
|
+
def setInitialZoom(initial_zoom)
|
1672
|
+
if (!(Integer(initial_zoom) > 0))
|
1673
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(initial_zoom, "initial_zoom", "html-to-pdf", "Must be a positive integer number.", "set_initial_zoom"), 470);
|
1674
|
+
end
|
1675
|
+
|
1676
|
+
@fields['initial_zoom'] = initial_zoom
|
1677
|
+
self
|
1678
|
+
end
|
1679
|
+
|
1680
|
+
# Specify whether to hide the viewer application's tool bars when the document is active.
|
1681
|
+
#
|
1682
|
+
# * +hide_toolbar+ - Set to true to hide tool bars.
|
1683
|
+
# * *Returns* - The converter object.
|
1684
|
+
def setHideToolbar(hide_toolbar)
|
1685
|
+
@fields['hide_toolbar'] = hide_toolbar
|
1686
|
+
self
|
1687
|
+
end
|
1688
|
+
|
1689
|
+
# Specify whether to hide the viewer application's menu bar when the document is active.
|
1690
|
+
#
|
1691
|
+
# * +hide_menubar+ - Set to true to hide the menu bar.
|
1692
|
+
# * *Returns* - The converter object.
|
1693
|
+
def setHideMenubar(hide_menubar)
|
1694
|
+
@fields['hide_menubar'] = hide_menubar
|
1695
|
+
self
|
1696
|
+
end
|
1697
|
+
|
1698
|
+
# Specify whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
|
1699
|
+
#
|
1700
|
+
# * +hide_window_ui+ - Set to true to hide ui elements.
|
1701
|
+
# * *Returns* - The converter object.
|
1702
|
+
def setHideWindowUi(hide_window_ui)
|
1703
|
+
@fields['hide_window_ui'] = hide_window_ui
|
1704
|
+
self
|
1705
|
+
end
|
1706
|
+
|
1707
|
+
# Specify whether to resize the document's window to fit the size of the first displayed page.
|
1708
|
+
#
|
1709
|
+
# * +fit_window+ - Set to true to resize the window.
|
1710
|
+
# * *Returns* - The converter object.
|
1711
|
+
def setFitWindow(fit_window)
|
1712
|
+
@fields['fit_window'] = fit_window
|
1713
|
+
self
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
# Specify whether to position the document's window in the center of the screen.
|
1717
|
+
#
|
1718
|
+
# * +center_window+ - Set to true to center the window.
|
1719
|
+
# * *Returns* - The converter object.
|
1720
|
+
def setCenterWindow(center_window)
|
1721
|
+
@fields['center_window'] = center_window
|
1722
|
+
self
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
# Specify whether the window's title bar should display the document title. If false , the title bar should instead display the name of the PDF file containing the document.
|
1726
|
+
#
|
1727
|
+
# * +display_title+ - Set to true to display the title.
|
1728
|
+
# * *Returns* - The converter object.
|
1729
|
+
def setDisplayTitle(display_title)
|
1730
|
+
@fields['display_title'] = display_title
|
1731
|
+
self
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
# Set the predominant reading order for text to right-to-left. This option has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up
|
1735
|
+
#
|
1736
|
+
# * +right_to_left+ - Set to true to set right-to-left reading order.
|
1737
|
+
# * *Returns* - The converter object.
|
1738
|
+
def setRightToLeft(right_to_left)
|
1739
|
+
@fields['right_to_left'] = right_to_left
|
1740
|
+
self
|
1741
|
+
end
|
1742
|
+
|
1743
|
+
# Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method.
|
1561
1744
|
#
|
1562
1745
|
# * +debug_log+ - Set to true to enable the debug logging.
|
1563
1746
|
# * *Returns* - The converter object.
|
@@ -1711,8 +1894,14 @@ module Pdfcrowd
|
|
1711
1894
|
end
|
1712
1895
|
|
1713
1896
|
output_file = open(file_path, "wb")
|
1714
|
-
|
1715
|
-
|
1897
|
+
begin
|
1898
|
+
convertUrlToStream(url, output_file)
|
1899
|
+
output_file.close()
|
1900
|
+
rescue Error => why
|
1901
|
+
output_file.close()
|
1902
|
+
FileUtils.rm(file_path)
|
1903
|
+
raise
|
1904
|
+
end
|
1716
1905
|
end
|
1717
1906
|
|
1718
1907
|
# Convert a local file.
|
@@ -1759,8 +1948,14 @@ module Pdfcrowd
|
|
1759
1948
|
end
|
1760
1949
|
|
1761
1950
|
output_file = open(file_path, "wb")
|
1762
|
-
|
1763
|
-
|
1951
|
+
begin
|
1952
|
+
convertFileToStream(file, output_file)
|
1953
|
+
output_file.close()
|
1954
|
+
rescue Error => why
|
1955
|
+
output_file.close()
|
1956
|
+
FileUtils.rm(file_path)
|
1957
|
+
raise
|
1958
|
+
end
|
1764
1959
|
end
|
1765
1960
|
|
1766
1961
|
# Convert a string.
|
@@ -1799,8 +1994,14 @@ module Pdfcrowd
|
|
1799
1994
|
end
|
1800
1995
|
|
1801
1996
|
output_file = open(file_path, "wb")
|
1802
|
-
|
1803
|
-
|
1997
|
+
begin
|
1998
|
+
convertStringToStream(text, output_file)
|
1999
|
+
output_file.close()
|
2000
|
+
rescue Error => why
|
2001
|
+
output_file.close()
|
2002
|
+
FileUtils.rm(file_path)
|
2003
|
+
raise
|
2004
|
+
end
|
1804
2005
|
end
|
1805
2006
|
|
1806
2007
|
# Do not print the background graphics.
|
@@ -1979,7 +2180,7 @@ module Pdfcrowd
|
|
1979
2180
|
self
|
1980
2181
|
end
|
1981
2182
|
|
1982
|
-
# Convert only the specified element and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
|
2183
|
+
# Convert only the specified element from the main document and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
|
1983
2184
|
#
|
1984
2185
|
# * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
|
1985
2186
|
# * *Returns* - The converter object.
|
@@ -2005,7 +2206,7 @@ module Pdfcrowd
|
|
2005
2206
|
self
|
2006
2207
|
end
|
2007
2208
|
|
2008
|
-
# Wait for the specified element in a source document. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails.
|
2209
|
+
# Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails.
|
2009
2210
|
#
|
2010
2211
|
# * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
|
2011
2212
|
# * *Returns* - The converter object.
|
@@ -2044,7 +2245,7 @@ module Pdfcrowd
|
|
2044
2245
|
self
|
2045
2246
|
end
|
2046
2247
|
|
2047
|
-
# Turn on the debug logging.
|
2248
|
+
# Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method.
|
2048
2249
|
#
|
2049
2250
|
# * +debug_log+ - Set to true to enable the debug logging.
|
2050
2251
|
# * *Returns* - The converter object.
|
@@ -2179,8 +2380,14 @@ module Pdfcrowd
|
|
2179
2380
|
end
|
2180
2381
|
|
2181
2382
|
output_file = open(file_path, "wb")
|
2182
|
-
|
2183
|
-
|
2383
|
+
begin
|
2384
|
+
convertUrlToStream(url, output_file)
|
2385
|
+
output_file.close()
|
2386
|
+
rescue Error => why
|
2387
|
+
output_file.close()
|
2388
|
+
FileUtils.rm(file_path)
|
2389
|
+
raise
|
2390
|
+
end
|
2184
2391
|
end
|
2185
2392
|
|
2186
2393
|
# Convert a local file.
|
@@ -2219,8 +2426,14 @@ module Pdfcrowd
|
|
2219
2426
|
end
|
2220
2427
|
|
2221
2428
|
output_file = open(file_path, "wb")
|
2222
|
-
|
2223
|
-
|
2429
|
+
begin
|
2430
|
+
convertFileToStream(file, output_file)
|
2431
|
+
output_file.close()
|
2432
|
+
rescue Error => why
|
2433
|
+
output_file.close()
|
2434
|
+
FileUtils.rm(file_path)
|
2435
|
+
raise
|
2436
|
+
end
|
2224
2437
|
end
|
2225
2438
|
|
2226
2439
|
# Convert raw data.
|
@@ -2251,8 +2464,14 @@ module Pdfcrowd
|
|
2251
2464
|
end
|
2252
2465
|
|
2253
2466
|
output_file = open(file_path, "wb")
|
2254
|
-
|
2255
|
-
|
2467
|
+
begin
|
2468
|
+
convertRawDataToStream(data, output_file)
|
2469
|
+
output_file.close()
|
2470
|
+
rescue Error => why
|
2471
|
+
output_file.close()
|
2472
|
+
FileUtils.rm(file_path)
|
2473
|
+
raise
|
2474
|
+
end
|
2256
2475
|
end
|
2257
2476
|
|
2258
2477
|
# The format of the output file.
|
@@ -2286,7 +2505,7 @@ module Pdfcrowd
|
|
2286
2505
|
self
|
2287
2506
|
end
|
2288
2507
|
|
2289
|
-
# Turn on the debug logging.
|
2508
|
+
# Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method.
|
2290
2509
|
#
|
2291
2510
|
# * +debug_log+ - Set to true to enable the debug logging.
|
2292
2511
|
# * *Returns* - The converter object.
|
@@ -2452,7 +2671,7 @@ module Pdfcrowd
|
|
2452
2671
|
self
|
2453
2672
|
end
|
2454
2673
|
|
2455
|
-
# Turn on the debug logging.
|
2674
|
+
# Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method.
|
2456
2675
|
#
|
2457
2676
|
# * +debug_log+ - Set to true to enable the debug logging.
|
2458
2677
|
# * *Returns* - The converter object.
|
@@ -2593,8 +2812,14 @@ module Pdfcrowd
|
|
2593
2812
|
end
|
2594
2813
|
|
2595
2814
|
output_file = open(file_path, "wb")
|
2596
|
-
|
2597
|
-
|
2815
|
+
begin
|
2816
|
+
convertUrlToStream(url, output_file)
|
2817
|
+
output_file.close()
|
2818
|
+
rescue Error => why
|
2819
|
+
output_file.close()
|
2820
|
+
FileUtils.rm(file_path)
|
2821
|
+
raise
|
2822
|
+
end
|
2598
2823
|
end
|
2599
2824
|
|
2600
2825
|
# Convert a local file.
|
@@ -2633,8 +2858,14 @@ module Pdfcrowd
|
|
2633
2858
|
end
|
2634
2859
|
|
2635
2860
|
output_file = open(file_path, "wb")
|
2636
|
-
|
2637
|
-
|
2861
|
+
begin
|
2862
|
+
convertFileToStream(file, output_file)
|
2863
|
+
output_file.close()
|
2864
|
+
rescue Error => why
|
2865
|
+
output_file.close()
|
2866
|
+
FileUtils.rm(file_path)
|
2867
|
+
raise
|
2868
|
+
end
|
2638
2869
|
end
|
2639
2870
|
|
2640
2871
|
# Convert raw data.
|
@@ -2665,8 +2896,14 @@ module Pdfcrowd
|
|
2665
2896
|
end
|
2666
2897
|
|
2667
2898
|
output_file = open(file_path, "wb")
|
2668
|
-
|
2669
|
-
|
2899
|
+
begin
|
2900
|
+
convertRawDataToStream(data, output_file)
|
2901
|
+
output_file.close()
|
2902
|
+
rescue Error => why
|
2903
|
+
output_file.close()
|
2904
|
+
FileUtils.rm(file_path)
|
2905
|
+
raise
|
2906
|
+
end
|
2670
2907
|
end
|
2671
2908
|
|
2672
2909
|
# Resize the image.
|
@@ -2687,7 +2924,7 @@ module Pdfcrowd
|
|
2687
2924
|
self
|
2688
2925
|
end
|
2689
2926
|
|
2690
|
-
# Turn on the debug logging.
|
2927
|
+
# Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method.
|
2691
2928
|
#
|
2692
2929
|
# * +debug_log+ - Set to true to enable the debug logging.
|
2693
2930
|
# * *Returns* - The converter object.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfcrowd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '4.
|
4
|
+
version: '4.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pdfcrowd Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The Pdfcrowd API lets you easily convert between HTML, PDF and various
|
14
14
|
image formats.
|
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
version: '0'
|
39
39
|
requirements: []
|
40
40
|
rubyforge_project:
|
41
|
-
rubygems_version: 2.5.1
|
41
|
+
rubygems_version: 2.5.2.1
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: A client for the Pdfcrowd API.
|