Skip to content

Commit

Permalink
feat: add pdf version
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Jan 3, 2025
1 parent 7784a36 commit d33b4da
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
* nodeId: non-negative-int,
* totalPages: non-negative-int,
* size: non-negative-int,
* pdfVersion: string,
* created_at: string,
* requested_by: array{
* userId: string,
Expand Down
1 change: 1 addition & 0 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ private function getFileMetadata(): array {
$dimensions = $pdfParserService->getPageDimensions();
$return['totalPages'] = $dimensions['p'];
$return['size'] = strlen($content);
$return['pdfVersion'] = $pdfParserService->getPdfVersion();
return $return;
}

Expand Down
5 changes: 5 additions & 0 deletions lib/Service/PdfParserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,9 @@ public function getPageDimensions(): array {
}
return $output;
}

public function getPdfVersion(): string {
preg_match('/^%PDF-(?<version>\d+(\.\d+)?)/', $this->content, $match);
return $match['version'];
}
}
4 changes: 4 additions & 0 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@
"nodeId",
"totalPages",
"size",
"pdfVersion",
"created_at",
"requested_by",
"file"
Expand Down Expand Up @@ -876,6 +877,9 @@
"format": "int64",
"minimum": 0
},
"pdfVersion": {
"type": "string"
},
"created_at": {
"type": "string"
},
Expand Down
4 changes: 4 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@
"nodeId",
"totalPages",
"size",
"pdfVersion",
"created_at",
"requested_by",
"file"
Expand Down Expand Up @@ -780,6 +781,9 @@
"format": "int64",
"minimum": 0
},
"pdfVersion": {
"type": "string"
},
"created_at": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,7 @@ export type components = {
totalPages: number;
/** Format: int64 */
size: number;
pdfVersion: string;
created_at: string;
requested_by: {
userId: string;
Expand Down
1 change: 1 addition & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ export type components = {
totalPages: number;
/** Format: int64 */
size: number;
pdfVersion: string;
created_at: string;
requested_by: {
userId: string;
Expand Down
8 changes: 8 additions & 0 deletions src/views/Validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
{{ size }}
</template>
</NcListItem>
<NcListItem class="extra"
compact
:name="t('libresign', 'PDF version:')">
<template #name>
<strong>{{ t('libresign', 'PDF version:') }}</strong>
{{ document.pdfVersion }}
</template>
</NcListItem>
</ul>
<div class="info-document">
<NcRichText class="legal-information"
Expand Down

0 comments on commit d33b4da

Please sign in to comment.