aspose_pdf_cloud 24.9.0 → 24.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/docs/DocRecognitionMode.md +4 -3
- data/docs/PdfApi.md +106 -0
- data/docs/SvgImages.md +11 -0
- data/docs/XmpMetadata.md +9 -0
- data/docs/XmpMetadataProperty.md +11 -0
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +326 -15
- data/lib/aspose_pdf_cloud/api_client.rb +1 -0
- data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +1 -0
- data/lib/aspose_pdf_cloud/models/svg_images.rb +226 -0
- data/lib/aspose_pdf_cloud/models/xmp_metadata.rb +201 -0
- data/lib/aspose_pdf_cloud/models/xmp_metadata_property.rb +243 -0
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/lib/aspose_pdf_cloud.rb +3 -0
- data/test/pdf_tests.rb +97 -3
- data/test_data/alfa.pdf +0 -0
- metadata +9 -2
data/test/pdf_tests.rb
CHANGED
@@ -30,7 +30,7 @@ class PdfTests < Minitest::Test
|
|
30
30
|
include AsposePdfCloud
|
31
31
|
|
32
32
|
def setup
|
33
|
-
servercreds_json = File.read('
|
33
|
+
servercreds_json = File.read('../../Settings/servercreds.json')
|
34
34
|
creds = JSON.parse(servercreds_json)
|
35
35
|
self_host = creds.has_key?("SelfHost") ? creds["SelfHost"] : false
|
36
36
|
app_key = creds.has_key?("AppKey") ? creds["AppKey"] : ""
|
@@ -38,7 +38,7 @@ class PdfTests < Minitest::Test
|
|
38
38
|
product_uri = creds.has_key?("ProductUri") ? creds["ProductUri"] : ""
|
39
39
|
@pdf_api = PdfApi.new(app_key, app_sid, product_uri, self_host)
|
40
40
|
@temp_folder = 'TempPdfCloud'
|
41
|
-
@test_data_folder = '
|
41
|
+
@test_data_folder = 'test_data/'
|
42
42
|
config = @pdf_api.api_client.config
|
43
43
|
config.scheme = 'https'
|
44
44
|
end
|
@@ -5188,6 +5188,19 @@ class PdfTests < Minitest::Test
|
|
5188
5188
|
assert(response, 'Failed to extract images as png.')
|
5189
5189
|
end
|
5190
5190
|
|
5191
|
+
def test_get_images_extract_svg
|
5192
|
+
name = "alfa.pdf"
|
5193
|
+
upload_file(name)
|
5194
|
+
|
5195
|
+
opts = {
|
5196
|
+
:folder => @temp_folder
|
5197
|
+
}
|
5198
|
+
|
5199
|
+
page_number = 1
|
5200
|
+
response = @pdf_api.get_images_extract_svg(name, page_number, opts)
|
5201
|
+
assert(response, 'Failed to extract images as svg.')
|
5202
|
+
end
|
5203
|
+
|
5191
5204
|
|
5192
5205
|
# Link Annotations Tests
|
5193
5206
|
|
@@ -6014,7 +6027,7 @@ class PdfTests < Minitest::Test
|
|
6014
6027
|
urx = 0
|
6015
6028
|
ury = 0
|
6016
6029
|
opts = {
|
6017
|
-
:format => ['First Page', 'Second
|
6030
|
+
:format => ['First Page', 'Second&Page'],
|
6018
6031
|
# :format => 'First Page',
|
6019
6032
|
:folder => @temp_folder
|
6020
6033
|
}
|
@@ -6598,4 +6611,85 @@ class PdfTests < Minitest::Test
|
|
6598
6611
|
assert(response, 'Failed to create a separate PDF from a PDF Layer.')
|
6599
6612
|
end
|
6600
6613
|
|
6614
|
+
# XMP Metadata Tests
|
6615
|
+
|
6616
|
+
def test_get_xmp_metadata_json
|
6617
|
+
file_name = '4pages.pdf'
|
6618
|
+
upload_file(file_name)
|
6619
|
+
|
6620
|
+
opts = {
|
6621
|
+
:folder => @temp_folder
|
6622
|
+
}
|
6623
|
+
|
6624
|
+
response = @pdf_api.get_xmp_metadata_json(file_name, opts)
|
6625
|
+
assert(response, 'Failed to get xmp metadata in json format')
|
6626
|
+
assert_equal(9, response[0].properties.count(), 'Failed to read document xmp metadata.')
|
6627
|
+
end
|
6628
|
+
|
6629
|
+
def test_get_xmp_metadata_xml
|
6630
|
+
file_name = '4pages.pdf'
|
6631
|
+
upload_file(file_name)
|
6632
|
+
|
6633
|
+
opts = {
|
6634
|
+
:folder => @temp_folder
|
6635
|
+
}
|
6636
|
+
|
6637
|
+
response = @pdf_api.get_xmp_metadata_xml(file_name, opts)
|
6638
|
+
assert(response, 'Failed to get xmp metadata in xml format')
|
6639
|
+
end
|
6640
|
+
|
6641
|
+
def test_post_xmp_metadata
|
6642
|
+
file_name = '4pages.pdf'
|
6643
|
+
upload_file(file_name)
|
6644
|
+
|
6645
|
+
opts = {
|
6646
|
+
:folder => @temp_folder
|
6647
|
+
}
|
6648
|
+
|
6649
|
+
date = "2024-10-27T09:59:52+02:00";
|
6650
|
+
metadata = XmpMetadata.new({
|
6651
|
+
:Properties => [
|
6652
|
+
XmpMetadataProperty.new({
|
6653
|
+
:Key => "ModifyDate",
|
6654
|
+
:Value => date
|
6655
|
+
}),
|
6656
|
+
# Modify Default property with prefix
|
6657
|
+
XmpMetadataProperty.new({
|
6658
|
+
:Key => "xmp:CreateDate",
|
6659
|
+
:Value => date
|
6660
|
+
}),
|
6661
|
+
# Remove Default property
|
6662
|
+
XmpMetadataProperty.new({
|
6663
|
+
:Key => "CreatorTool",
|
6664
|
+
}),
|
6665
|
+
# Add Default property
|
6666
|
+
XmpMetadataProperty.new({
|
6667
|
+
:Key => "BaseURL",
|
6668
|
+
:Value => "http://www.somename.com/path"
|
6669
|
+
}),
|
6670
|
+
# Remove User defined property
|
6671
|
+
XmpMetadataProperty.new({
|
6672
|
+
:Key => "dc:title",
|
6673
|
+
}),
|
6674
|
+
# Update user defined property
|
6675
|
+
XmpMetadataProperty.new({
|
6676
|
+
:Key => "pdf:Producer",
|
6677
|
+
:Value => "Aspose.PDF Cloud",
|
6678
|
+
:NamespaceUri => "http://ns.adobe.com/pdf/1.3/"
|
6679
|
+
}),
|
6680
|
+
# Add user defined property
|
6681
|
+
XmpMetadataProperty.new({
|
6682
|
+
:Key => "pdf:Prop",
|
6683
|
+
:Value => "PropValue",
|
6684
|
+
:NamespaceUri => "http://ns.adobe.com/pdf/1.3/"
|
6685
|
+
})
|
6686
|
+
]
|
6687
|
+
})
|
6688
|
+
response = @pdf_api.post_xmp_metadata(file_name, metadata, opts)
|
6689
|
+
assert(response, 'Failed to post xmp metadata')
|
6690
|
+
|
6691
|
+
response = @pdf_api.get_xmp_metadata_json(file_name, opts)
|
6692
|
+
assert(response, 'Failed to get xmp metadata in json format')
|
6693
|
+
assert_equal(9, response[0].properties.count(), 'Failed to read document xmp metadata.')
|
6694
|
+
end
|
6601
6695
|
end
|
data/test_data/alfa.pdf
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspose_pdf_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 24.
|
4
|
+
version: 24.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aspose PDF Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -433,6 +433,7 @@ files:
|
|
433
433
|
- docs/StrikeOutAnnotationResponse.md
|
434
434
|
- docs/StrikeOutAnnotations.md
|
435
435
|
- docs/StrikeOutAnnotationsResponse.md
|
436
|
+
- docs/SvgImages.md
|
436
437
|
- docs/Table.md
|
437
438
|
- docs/TableBroken.md
|
438
439
|
- docs/TableRecognized.md
|
@@ -470,6 +471,8 @@ files:
|
|
470
471
|
- docs/WordCount.md
|
471
472
|
- docs/WordCountResponse.md
|
472
473
|
- docs/WrapMode.md
|
474
|
+
- docs/XmpMetadata.md
|
475
|
+
- docs/XmpMetadataProperty.md
|
473
476
|
- lib/aspose_pdf_cloud.rb
|
474
477
|
- lib/aspose_pdf_cloud/api/pdf_api.rb
|
475
478
|
- lib/aspose_pdf_cloud/api_client.rb
|
@@ -725,6 +728,7 @@ files:
|
|
725
728
|
- lib/aspose_pdf_cloud/models/strike_out_annotation_response.rb
|
726
729
|
- lib/aspose_pdf_cloud/models/strike_out_annotations.rb
|
727
730
|
- lib/aspose_pdf_cloud/models/strike_out_annotations_response.rb
|
731
|
+
- lib/aspose_pdf_cloud/models/svg_images.rb
|
728
732
|
- lib/aspose_pdf_cloud/models/table.rb
|
729
733
|
- lib/aspose_pdf_cloud/models/table_broken.rb
|
730
734
|
- lib/aspose_pdf_cloud/models/table_recognized.rb
|
@@ -762,6 +766,8 @@ files:
|
|
762
766
|
- lib/aspose_pdf_cloud/models/word_count.rb
|
763
767
|
- lib/aspose_pdf_cloud/models/word_count_response.rb
|
764
768
|
- lib/aspose_pdf_cloud/models/wrap_mode.rb
|
769
|
+
- lib/aspose_pdf_cloud/models/xmp_metadata.rb
|
770
|
+
- lib/aspose_pdf_cloud/models/xmp_metadata_property.rb
|
765
771
|
- lib/aspose_pdf_cloud/version.rb
|
766
772
|
- test/pdf_tests.rb
|
767
773
|
- test_data/.gitattributes
|
@@ -808,6 +814,7 @@ files:
|
|
808
814
|
- test_data/Typography.PS
|
809
815
|
- test_data/XslfoExample.xslfo
|
810
816
|
- test_data/adbe.x509.rsa_sha1.valid.pdf
|
817
|
+
- test_data/alfa.pdf
|
811
818
|
- test_data/butterfly.jpg
|
812
819
|
- test_data/marketing.pdf
|
813
820
|
- test_data/mixed.md
|