Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
61ef1162
authored
2016-05-02 14:15:30 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
e
1 parent
bb0c41be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
19 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/FileEntryController.php
app/Http/Controllers/PdfController.php
app/Http/routes.php
app/Http/Controllers/ApiController.php
View file @
61ef116
...
...
@@ -95,6 +95,22 @@ class ApiController extends Controller
}
public
function
update
(
$json
)
{
$apiCallId
=
new
pdfModel
();
$apiCallId
=
$apiCallId
->
addApiCall
(
'1'
,
$json
);
//$apiCallId = "3";
$pdfId
=
new
pdfModel
();
$pdfId
=
$pdfId
->
addPdf
(
$apiCallId
,
$json
);
$pdf
=
new
PdfController
();
$pdf
=
$pdf
->
pdf
(
$pdfId
);
$response
=
$pdf
;
$statusCode
=
200
;
return
Response
::
json
(
$response
,
$statusCode
);
}
public
function
getList
(
$json
)
...
...
@@ -109,12 +125,15 @@ class ApiController extends Controller
public
function
getApi
(
$json
)
{
$statusCode
=
200
;
$response
=
include
(
'js/interface.js'
);
return
Response
::
json
(
$response
,
$statusCode
);
$file
=
Storage
::
disk
(
'public'
)
->
get
(
'interface.js'
);
return
$file
;
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
'text/html'
);
}
public
function
getPdf
(
$json
)
{
$rows
=
new
pdfModel
();
...
...
@@ -125,11 +144,6 @@ class ApiController extends Controller
}
public
function
view
(
File
$file
)
{
$response
=
new
BinaryFileResponse
(
$file
->
getAbsolutePath
());
$response
->
headers
->
set
(
'Content-Disposition'
,
'inline; filename="'
.
$file
->
real_filename
.
'"'
);
return
$response
;
}
}
...
...
app/Http/Controllers/FileEntryController.php
View file @
61ef116
...
...
@@ -45,6 +45,7 @@ class FileEntryController extends Controller {
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
'image/jpeg'
);
}
public
function
get
(
$filename
){
$entry
=
Fileentry
::
where
(
'filename'
,
'='
,
$filename
)
->
firstOrFail
();
...
...
@@ -53,4 +54,13 @@ class FileEntryController extends Controller {
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
$entry
->
mime
);
}
public
function
getApi
(
$json
)
{
$file
=
Storage
::
disk
(
'public'
)
->
get
(
'js/interface.js'
);
return
(
new
Response
(
$file
,
200
))
->
header
(
'Content-Type'
,
'text/html'
);
}
}
...
...
app/Http/Controllers/PdfController.php
View file @
61ef116
...
...
@@ -34,7 +34,7 @@ class PdfController extends Controller
$outfile
=
""
;
$title
=
"Test Pages"
;
$storagePath
=
Storage
::
disk
(
'local'
)
->
getDriver
()
->
getAdapter
()
->
getPathPrefix
();
//
$outfile = $storagePath.$searchpath."/new_".$rows[0]->file;
$outfile
=
$storagePath
.
$searchpath
.
"/new_"
.
$rows
[
0
]
->
file
;
try
{
...
...
@@ -152,15 +152,17 @@ try {
$p
->
end_document
(
""
);
return
$outfile
;
/// To turn on pdf screen out put uncomment below lines and remove the text in $output="" Var
$buf
=
$p
->
get_buffer
();
$len
=
strlen
(
$buf
);
//
$buf = $p->get_buffer();
//
$len = strlen($buf);
header
(
"Content-type: application/pdf"
);
header
(
"Content-Length:
$len
"
);
header
(
"Content-Disposition: inline; filename=test_pages.pdf"
);
print
$buf
;
//
header("Content-type: application/pdf");
//
header("Content-Length: $len");
//
header("Content-Disposition: inline; filename=test_pages.pdf");
//
print $buf;
...
...
app/Http/routes.php
View file @
61ef116
...
...
@@ -23,15 +23,21 @@ Route::group(array('prefix' => 'api/v1'), function($json)
{
Route
::
resource
(
'add'
,
'ApiController@insert'
);
Route
::
resource
(
'update'
,
'ApiController@update'
);
Route
::
resource
(
'get-list'
,
'ApiController@getList'
);
Route
::
resource
(
'get-pdf'
,
'ApiController@getpdf'
);
Route
::
resource
(
'api'
,
'
Api
Controller@getApi'
);
Route
::
resource
(
'api'
,
'
FileEntry
Controller@getApi'
);
});
Route
::
get
(
'
fileentry'
,
'FileEntryController@index
'
);
Route
::
get
(
'fileentry/getone/{folder}/{filename}'
,
'FileEntryController@getone'
);
Route
::
get
(
'
api/v1/update'
,
'ApiController@getpdf
'
);
Route
::
get
(
'fileentry/get/{filename}'
,
[
'as'
=>
'getentry'
,
'uses'
=>
'FileEntryController@get'
]);
Route
::
get
(
'fileentry'
,
'FileEntryController@index'
);
Route
::
get
(
'fileentry/getone/{folder}/{filename}'
,
'FileEntryController@getone'
);
Route
::
post
(
'fileentry/add'
,[
'as'
=>
'addentry'
,
'uses'
=>
'FileEntryController@add'
]);
...
...
Please
register
or
sign in
to post a comment