aspose_pdf_cloud 19.6.0 → 19.7.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 +19 -4
- data/docs/DocumentPrivilege.md +1 -1
- data/docs/PdfApi.md +388 -1
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +1280 -125
- data/lib/aspose_pdf_cloud/models/document_privilege.rb +1 -1
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/test/pdf_tests.rb +230 -2
- data/test_data/FormData.fdf +0 -0
- data/test_data/FormData.pdf +0 -0
- data/test_data/FormDataXfa_in.pdf +0 -0
- data/test_data/FormDataXfa_in.xml +8 -0
- data/test_data/FormDataXfdf_in.pdf +0 -0
- data/test_data/FormDataXfdf_in.xfdf +21 -0
- metadata +8 -2
@@ -23,7 +23,7 @@ require 'date'
|
|
23
23
|
require 'time'
|
24
24
|
|
25
25
|
module AsposePdfCloud
|
26
|
-
# Represents the privileges for accessing Pdf file
|
26
|
+
# Represents the privileges for accessing Pdf file.
|
27
27
|
class DocumentPrivilege
|
28
28
|
# Sets the permission which allow print or not. true is allow and false or not set is forbidden.
|
29
29
|
attr_accessor :allow_print
|
data/test/pdf_tests.rb
CHANGED
@@ -127,8 +127,8 @@ class PdfTests < Minitest::Test
|
|
127
127
|
upload_file(file_name)
|
128
128
|
|
129
129
|
opts = {
|
130
|
-
:
|
131
|
-
:
|
130
|
+
:end_page => 2,
|
131
|
+
:annotation_types => [AnnotationType::STAMP],
|
132
132
|
:folder => @temp_folder
|
133
133
|
}
|
134
134
|
|
@@ -5378,4 +5378,232 @@ class PdfTests < Minitest::Test
|
|
5378
5378
|
response = @pdf_api.put_bookmark(file_name, path, bookmark, opts)
|
5379
5379
|
assert(response, 'Filed to update bookmark.')
|
5380
5380
|
end
|
5381
|
+
|
5382
|
+
# Import Export Tests
|
5383
|
+
|
5384
|
+
def test_get_export_fields_from_pdf_to_xml_in_storage
|
5385
|
+
file_name = 'FormData.pdf'
|
5386
|
+
upload_file(file_name)
|
5387
|
+
|
5388
|
+
opts = {
|
5389
|
+
:folder => @temp_folder
|
5390
|
+
}
|
5391
|
+
|
5392
|
+
response = @pdf_api.get_export_fields_from_pdf_to_xml_in_storage(file_name, opts)
|
5393
|
+
assert(response, 'Filed to export fields to xml.')
|
5394
|
+
end
|
5395
|
+
|
5396
|
+
def test_get_export_fields_from_pdf_to_fdf_in_storage
|
5397
|
+
file_name = 'FormData.pdf'
|
5398
|
+
upload_file(file_name)
|
5399
|
+
|
5400
|
+
opts = {
|
5401
|
+
:folder => @temp_folder
|
5402
|
+
}
|
5403
|
+
|
5404
|
+
response = @pdf_api.get_export_fields_from_pdf_to_fdf_in_storage(file_name, opts)
|
5405
|
+
assert(response, 'Filed to export fields to fdf.')
|
5406
|
+
end
|
5407
|
+
|
5408
|
+
def test_get_export_fields_from_pdf_to_xfdf_in_storage
|
5409
|
+
file_name = 'FormData.pdf'
|
5410
|
+
upload_file(file_name)
|
5411
|
+
|
5412
|
+
opts = {
|
5413
|
+
:folder => @temp_folder
|
5414
|
+
}
|
5415
|
+
|
5416
|
+
response = @pdf_api.get_export_fields_from_pdf_to_xfdf_in_storage(file_name, opts)
|
5417
|
+
assert(response, 'Filed to export fields to xfdf.')
|
5418
|
+
end
|
5419
|
+
|
5420
|
+
def test_put_export_fields_from_pdf_to_xml_in_storage
|
5421
|
+
file_name = 'FormData.pdf'
|
5422
|
+
upload_file(file_name)
|
5423
|
+
|
5424
|
+
out_path = @temp_folder + '/exportData.xml'
|
5425
|
+
|
5426
|
+
opts = {
|
5427
|
+
:folder => @temp_folder
|
5428
|
+
}
|
5429
|
+
|
5430
|
+
response = @pdf_api.put_export_fields_from_pdf_to_xml_in_storage(file_name, out_path, opts)
|
5431
|
+
assert(response, 'Filed to export fields to xml.')
|
5432
|
+
end
|
5433
|
+
|
5434
|
+
def test_put_export_fields_from_pdf_to_fdf_in_storage
|
5435
|
+
file_name = 'FormData.pdf'
|
5436
|
+
upload_file(file_name)
|
5437
|
+
|
5438
|
+
out_path = @temp_folder + '/exportData.fdf'
|
5439
|
+
|
5440
|
+
opts = {
|
5441
|
+
:folder => @temp_folder
|
5442
|
+
}
|
5443
|
+
|
5444
|
+
response = @pdf_api.put_export_fields_from_pdf_to_fdf_in_storage(file_name, out_path, opts)
|
5445
|
+
assert(response, 'Filed to export fields to fdf.')
|
5446
|
+
end
|
5447
|
+
|
5448
|
+
def test_put_export_fields_from_pdf_to_xfdf_in_storage
|
5449
|
+
file_name = 'FormData.pdf'
|
5450
|
+
upload_file(file_name)
|
5451
|
+
|
5452
|
+
out_path = @temp_folder + '/exportData.xfdf'
|
5453
|
+
|
5454
|
+
opts = {
|
5455
|
+
:folder => @temp_folder
|
5456
|
+
}
|
5457
|
+
|
5458
|
+
response = @pdf_api.put_export_fields_from_pdf_to_xfdf_in_storage(file_name, out_path, opts)
|
5459
|
+
assert(response, 'Filed to export fields to xfdf.')
|
5460
|
+
end
|
5461
|
+
|
5462
|
+
|
5463
|
+
def test_get_import_fields_from_fdf_in_storage
|
5464
|
+
file_name = 'FormData.pdf'
|
5465
|
+
upload_file(file_name)
|
5466
|
+
|
5467
|
+
data_file = 'FormData.fdf'
|
5468
|
+
upload_file(data_file)
|
5469
|
+
|
5470
|
+
data_file_path = @temp_folder + '/' + data_file
|
5471
|
+
|
5472
|
+
opts = {
|
5473
|
+
:folder => @temp_folder
|
5474
|
+
}
|
5475
|
+
|
5476
|
+
response = @pdf_api.get_import_fields_from_fdf_in_storage(file_name, data_file_path, opts)
|
5477
|
+
assert(response, 'Filed to import fields from fdf.')
|
5478
|
+
end
|
5479
|
+
|
5480
|
+
def test_get_import_fields_from_xfdf_in_storage
|
5481
|
+
file_name = 'FormDataXfdf_in.pdf'
|
5482
|
+
upload_file(file_name)
|
5483
|
+
|
5484
|
+
data_file = 'FormDataXfdf_in.xfdf'
|
5485
|
+
upload_file(data_file)
|
5486
|
+
|
5487
|
+
data_file_path = @temp_folder + '/' + data_file
|
5488
|
+
|
5489
|
+
opts = {
|
5490
|
+
:folder => @temp_folder
|
5491
|
+
}
|
5492
|
+
|
5493
|
+
response = @pdf_api.get_import_fields_from_xfdf_in_storage(file_name, data_file_path, opts)
|
5494
|
+
assert(response, 'Filed to import fields from xfdf.')
|
5495
|
+
end
|
5496
|
+
|
5497
|
+
def test_get_import_fields_from_xml_in_storage
|
5498
|
+
file_name = 'FormDataXfa_in.pdf'
|
5499
|
+
upload_file(file_name)
|
5500
|
+
|
5501
|
+
data_file = 'FormDataXfa_in.xml'
|
5502
|
+
upload_file(data_file)
|
5503
|
+
|
5504
|
+
data_file_path = @temp_folder + '/' + data_file
|
5505
|
+
|
5506
|
+
opts = {
|
5507
|
+
:folder => @temp_folder
|
5508
|
+
}
|
5509
|
+
|
5510
|
+
response = @pdf_api.get_import_fields_from_xml_in_storage(file_name, data_file_path, opts)
|
5511
|
+
assert(response, 'Filed to import fields from xml.')
|
5512
|
+
end
|
5513
|
+
|
5514
|
+
def test_put_import_fields_from_fdf_in_storage
|
5515
|
+
file_name = 'FormData.pdf'
|
5516
|
+
upload_file(file_name)
|
5517
|
+
|
5518
|
+
data_file = 'FormData.fdf'
|
5519
|
+
upload_file(data_file)
|
5520
|
+
|
5521
|
+
data_file_path = @temp_folder + '/' + data_file
|
5522
|
+
|
5523
|
+
opts = {
|
5524
|
+
:folder => @temp_folder
|
5525
|
+
}
|
5526
|
+
|
5527
|
+
response = @pdf_api.put_import_fields_from_fdf_in_storage(file_name, data_file_path, opts)
|
5528
|
+
assert(response, 'Filed to import fields from fdf.')
|
5529
|
+
end
|
5530
|
+
|
5531
|
+
def test_put_import_fields_from_xfdf_in_storage
|
5532
|
+
file_name = 'FormDataXfdf_in.pdf'
|
5533
|
+
upload_file(file_name)
|
5534
|
+
|
5535
|
+
data_file = 'FormDataXfdf_in.xfdf'
|
5536
|
+
upload_file(data_file)
|
5537
|
+
|
5538
|
+
data_file_path = @temp_folder + '/' + data_file
|
5539
|
+
|
5540
|
+
opts = {
|
5541
|
+
:folder => @temp_folder
|
5542
|
+
}
|
5543
|
+
|
5544
|
+
response = @pdf_api.put_import_fields_from_xfdf_in_storage(file_name, data_file_path, opts)
|
5545
|
+
assert(response, 'Filed to import fields from xfdf.')
|
5546
|
+
end
|
5547
|
+
|
5548
|
+
def test_put_import_fields_from_xml_in_storage
|
5549
|
+
file_name = 'FormDataXfa_in.pdf'
|
5550
|
+
upload_file(file_name)
|
5551
|
+
|
5552
|
+
data_file = 'FormDataXfa_in.xml'
|
5553
|
+
upload_file(data_file)
|
5554
|
+
|
5555
|
+
data_file_path = @temp_folder + '/' + data_file
|
5556
|
+
|
5557
|
+
opts = {
|
5558
|
+
:folder => @temp_folder
|
5559
|
+
}
|
5560
|
+
|
5561
|
+
response = @pdf_api.put_import_fields_from_xml_in_storage(file_name, data_file_path, opts)
|
5562
|
+
assert(response, 'Filed to import fields from xml.')
|
5563
|
+
end
|
5564
|
+
|
5565
|
+
def test_post_import_fields_from_fdf
|
5566
|
+
file_name = 'FormData.pdf'
|
5567
|
+
upload_file(file_name)
|
5568
|
+
|
5569
|
+
data_file = 'FormData.fdf'
|
5570
|
+
|
5571
|
+
opts = {
|
5572
|
+
:folder => @temp_folder,
|
5573
|
+
:fdf_data => ::File.open(@test_data_folder + data_file, 'r') { |io| io.read(io.size) }
|
5574
|
+
}
|
5575
|
+
|
5576
|
+
response = @pdf_api.post_import_fields_from_fdf(file_name, opts)
|
5577
|
+
assert(response, 'Filed to import fields from fdf.')
|
5578
|
+
end
|
5579
|
+
|
5580
|
+
def test_post_import_fields_from_xfdf
|
5581
|
+
file_name = 'FormDataXfdf_in.pdf'
|
5582
|
+
upload_file(file_name)
|
5583
|
+
|
5584
|
+
data_file = 'FormDataXfdf_in.xfdf'
|
5585
|
+
|
5586
|
+
opts = {
|
5587
|
+
:folder => @temp_folder,
|
5588
|
+
:xfdf_data => ::File.open(@test_data_folder + data_file, 'r') { |io| io.read(io.size) }
|
5589
|
+
}
|
5590
|
+
|
5591
|
+
response = @pdf_api.post_import_fields_from_xfdf(file_name, opts)
|
5592
|
+
assert(response, 'Filed to import fields from xfdf.')
|
5593
|
+
end
|
5594
|
+
|
5595
|
+
def test_post_import_fields_from_xml
|
5596
|
+
file_name = 'FormDataXfa_in.pdf'
|
5597
|
+
upload_file(file_name)
|
5598
|
+
|
5599
|
+
data_file = 'FormDataXfa_in.xml'
|
5600
|
+
|
5601
|
+
opts = {
|
5602
|
+
:folder => @temp_folder,
|
5603
|
+
:xml_data => ::File.open(@test_data_folder + data_file, 'r') { |io| io.read(io.size) }
|
5604
|
+
}
|
5605
|
+
|
5606
|
+
response = @pdf_api.post_import_fields_from_xml(file_name, opts)
|
5607
|
+
assert(response, 'Filed to import fields from xml.')
|
5608
|
+
end
|
5381
5609
|
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
|
3
|
+
<form1>
|
4
|
+
<FirstName>Dou</FirstName>
|
5
|
+
<LastName>Jon</LastName>
|
6
|
+
<HiddenField><![CDATA[<Root><HeaderId>999</HeaderId></Root>]]></HiddenField>
|
7
|
+
</form1>
|
8
|
+
</xfa:data>
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
|
3
|
+
<f href="test.pdf"/>
|
4
|
+
<fields>
|
5
|
+
<field name="Country">
|
6
|
+
<value>Deutschland</value>
|
7
|
+
</field>
|
8
|
+
<field name="State">
|
9
|
+
<value>Freie & Hansestadt Hamburg</value>
|
10
|
+
</field>
|
11
|
+
<field name="City">
|
12
|
+
<value>Hamburger</value>
|
13
|
+
</field>
|
14
|
+
<field name="Email">
|
15
|
+
<value>dirk.pass@bs-card-service.com</value>
|
16
|
+
</field>
|
17
|
+
<field name="FullName">
|
18
|
+
<value>Dirk Pass</value>
|
19
|
+
</field>
|
20
|
+
</fields>
|
21
|
+
</xfdf>
|
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: 19.
|
4
|
+
version: 19.7.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: 2019-
|
11
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -551,6 +551,12 @@ files:
|
|
551
551
|
- test_data/4pages.pdf
|
552
552
|
- test_data/4pagesEncrypted.pdf
|
553
553
|
- test_data/BlankWithSignature.pdf
|
554
|
+
- test_data/FormData.fdf
|
555
|
+
- test_data/FormData.pdf
|
556
|
+
- test_data/FormDataXfa_in.pdf
|
557
|
+
- test_data/FormDataXfa_in.xml
|
558
|
+
- test_data/FormDataXfdf_in.pdf
|
559
|
+
- test_data/FormDataXfdf_in.xfdf
|
554
560
|
- test_data/Hello_world.pdf
|
555
561
|
- test_data/HtmlExample1.html
|
556
562
|
- test_data/HtmlWithImage.zip
|