使用Apache PDFBox将实心圆圈添加到PDF页面(Adding of filled circles to PDF page using Apache PDFBox)
我正在尝试使用Apache PDFBox库以编程方式创建PDF文档。 类PDPageContentStream包含写入文本,绘制线条,贝塞尔曲线,矩形的方法。 但我找不到一种方法来绘制一个简单的实心圆。 有没有办法使用这个库来绘制它? 如果没有,您可以请建议一个免费的Java库,提供灵活的API以编程方式创建PDF文档? 提前致谢。
I'm trying to use the Apache PDFBox library to create a PDF document programmatically. The class PDPageContentStream contains methods to write text, draw lines, bezier curves, rectangles. But I can't find a way to draw a simple filled circle. Is there a way to draw it using this library? If not, can you please suggest a free Java library that provides flexible API to create PDF documents programmatically? Thanks in advance.
原文:https://stackoverflow.com/questions/42811353
最满意答案
我看到几个问题..
如果使用表单助手 (
Form::open()
/Form::close()
),则无需手动包含隐藏的CSRF令牌元素。 然而,更大的问题是你的javascript:$('.profile-image .delete a.delete').click(function() { $(this).parent().find('.deletepic').click(); }); $.('form[name=delete-profile-image]')({ url: $('form[name=update-account]').data('image-delete'), type: 'POST', dataType: 'json' });
AJAX呼叫在哪里? (提示,它只是不存在..)当你可以在锚点本身触发AJAX调用时,为什么你会有一个锚元素触发单击表单内的隐藏按钮? 尝试将HTML更改为类似的内容......
@if (!empty($image)) <a href="#" class="delete">Delete</a> {{ Form::open(array('url' => route('customer.account.profile.image.delete'), 'style' => 'display: none', 'id' => 'image_delete')) }} {{ Form::text('image', $image) }} {{ Form::close() }} @endif
并将您的javascript更新为以下内容:
$('.profile-image .delete a.delete').click(function() { $('#image_delete').submit() });
Couple of issues I see..
If you use the form helpers (
Form::open()
/Form::close()
) you won't need to include the hidden CSRF token element manually. However the bigger issue is your javascript:$('.profile-image .delete a.delete').click(function() { $(this).parent().find('.deletepic').click(); }); $.('form[name=delete-profile-image]')({ url: $('form[name=update-account]').data('image-delete'), type: 'POST', dataType: 'json' });
Where is the AJAX call? (Hint, it's just not there..) Why would you have an anchor element trigger a click on a hidden button inside a form when you can just fire off the AJAX call on the anchor itself? Try changing your HTML to something like this...
@if (!empty($image)) <a href="#" class="delete">Delete</a> {{ Form::open(array('url' => route('customer.account.profile.image.delete'), 'style' => 'display: none', 'id' => 'image_delete')) }} {{ Form::text('image', $image) }} {{ Form::close() }} @endif
And update your javascript to something like this:
$('.profile-image .delete a.delete').click(function() { $('#image_delete').submit() });
相关问答
更多-
Laravel - 如何通过AJAX(jQuery)调用控制器函数(Laravel - How to call a controller function via AJAX (jQuery))[2020-11-14]
您可以在成功时返回json响应: public function add( $user_id, $project_id ) { // Other code ... $isSuccess = false; if ($project->user_id != $user_id) { $scrapbook = Scrapbook::firstOrNew(['user_id' => $user_id]); if ($isSuccess = $scrapb ... -
我看到几个问题.. 如果使用表单助手 ( Form::open() / Form::close() ),则无需手动包含隐藏的CSRF令牌元素。 然而,更大的问题是你的javascript: $('.profile-image .delete a.delete').click(function() { $(this).parent().find('.deletepic').click(); }); $.('form[name=delete-profile-image]')({ url: $( ...
-
function contentDisp(url) { $.ajax({ url : url, success : function (data) { $("#dynamicContent").html(data); } }); }
- BREAST
然而,我会建议你删除onClick处理程序,并把网址作为href这样的方式与js关闭用户仍然得 ... -
看起来这是因为jQuery将#符号视为锚点指示符,并将其后的所有内容都删除。 那不是jQuery,那是浏览器。 片段标识符永远不会作为URL的一部分发送到服务器。 您提供的URL会引发404错误(可能是您尝试提供示例URL,请使用example.com , foo.com是一个真实的网站!)但我会假设页面上显示的任何内容都会发生变化基于#被客户端JavaScript放在页面中,而不是服务器。 为了复制它,您需要对其JS进行反向工程,并在您自己的代码中重现它对页面所做的更改。 It appears as th ...
-
I want to call a controller method from jsp 你不能从jsp这样做,因为jsp将在服务器上的servlet中编译,这个servlet将返回一个html页面到客户端。 所以你可以从html而不是从jsp这样做。 But i wish to know is it possible in jquery to call a controller method (Or to hit a url as a normal url hit) without ajax. 您可以重 ...
-
尝试改变路线 Route::post('/controle/pending/concludeAll', function() { $input = Input::only('ids'); $input = $input['ids']; foreach($input as $id) { $student = new App\Aluno(); $student = $student->where('id', '=', $id)->first(); ...
-
在Ajax调用中传递完整的URL作为参数 - Laravel 5.1路由(Passing full URL as parameter in Ajax call - Laravel 5.1 routing)[2024-04-11]
var url = '/ajax/?act=url&u=' + encodeURIComponent(website); 这应该工作! var url = '/ajax/?act=url&u=' + encodeURIComponent(website); this should work! -
默认情况下,Laravel在获得POST请求时需要_token参数。 您通常使用带有{!! csrf_token !!}刀片将其添加到表单中 {!! csrf_token !!} 。 使用Ajax也没有什么不同。 如果要执行POST请求,则需要将_token参数添加到请求中。 您可以通过将其直接添加到Ajax参数中,或者通过将jQuery添加到布局视图中告诉jQuery来处理它来实现此操作; 。 这是你 ...
-
你可以保持url干净并将变量作为ajax调用中的数据传递。 var urlGetUser = "{{ URL::route('getUser') }}", userId = $(this).attr('user_id'); $.ajax({ type: "POST", url: urlGetUser, data: { id: userId } }).done(function( msg ) { alert( msg ); }); 这样您就不必为每个可能的用户ID创建ajax调用。 ...
-
您可以通过验证设置参数的最小长度。 将它放入您的控制器并限制js代码minLength: 3中的最小长度。 use Validator; // at the top of controller public function search(Request $request) { $v = Validator::make($request->all(), [ 'q' => 'required|min:3', ]); if ($v->fails()) { ...